Skip to content

Instantly share code, notes, and snippets.

@ckschmieder
Last active May 8, 2017 04:29
Show Gist options
  • Save ckschmieder/201f80a0788c9c47b59fab4982e3a492 to your computer and use it in GitHub Desktop.
Save ckschmieder/201f80a0788c9c47b59fab4982e3a492 to your computer and use it in GitHub Desktop.
$(function() {
$("#NationalPhotoMonth_submitButton").click(function(event) {
if (!$("#NationalPhotoMonth_Field_48").is(":checked")) {
event.stopImmediatePropagation();
alert('You must agree to the Terms and Conditions!');
}
});
});
@ckschmieder
Copy link
Author

The stopImmediatePropagation() method prevents other listeners of the same event from being called.
When clicking on a button, execute the first event handler, and stop the rest of the event handlers from being executed.
https://www.w3schools.com/jsref/event_stopimmediatepropagation.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment