Created
May 6, 2017 20:22
-
-
Save ckschmieder/b9cd22e2b6e9dae759afbae85e228b28 to your computer and use it in GitHub Desktop.
Trying to prevent submission of the form if the checkbox isn't checked. The alert is working properly but the form still submits after dismissing the alert.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('#NationalPhotoMonth_submitButton').click(function(e) { | |
e.preventDefault(); | |
if(!$('#NationalPhotoMonth_Field_48').is(':checked')){ | |
alert('You must agree to the term and conditions.'); | |
return false; | |
} | |
if($('#NationalPhotoMonth_Field_48').is(':checked')){ | |
return true; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment