Categories
Development

How to end JQuery function in if()

I tried to end JQuery function using return; but I want to stop function before running more line of function. My code is here :

$('#quantity').on('input',function(e){
    var variable = $('#var').val();
    if (variable == null) {
        alert('variable is null.')
        return;
        }
    //Normal code
})

When I try to test it //Normal code will be run and return; cannot stop running more lines.

Note: I can’t use else because of reasons in my codes.

Leave an answer

Your email address will not be published. Required fields are marked *