Last active
December 21, 2015 03:19
-
-
Save jawinn/6241779 to your computer and use it in GitHub Desktop.
jQuery - Required checkbox to submit form (simple w/ alert)
This file contains 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
// checkbox must be checked to submit form | |
$('#contact-submit').click(function(e) { | |
var checked = $('#contact-side :checkbox:checked').length; | |
if (checked == 0) { | |
alert('Before this form can be sent, you must agree to the disclaimer.'); | |
e.preventDefault(); | |
} else { | |
$('#contact-side form').submit(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment