$('#button').click(function() {
$('.field').each(function() {
if (condition) {
return false;
}
});
alert("This alerts even when loop returns false");
});
If my if condition reaches return false; the script will continue to move through the $.click event. Is it possible to completely stop all javascript functions/events?
That
returnends the inner function block; to end the outer block, use anotherreturn:(Alternatively you could conditionally execute the remaining code based on a boolean variable that you set, similar to how I set
exit)