Created
October 17, 2012 01:48
-
-
Save imarkdesigns/3903272 to your computer and use it in GitHub Desktop.
Disabled Submit Button with jQuery Script
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
| <form> | |
| <input type="checkbox" name="agree" id="agree" value="1"> | |
| <button type="submit" class="btn">Accept Terms & Conditions</button> | |
| </form> | |
| <script> | |
| $(function(){ | |
| $('.btn').attr('disabled', 'disabled'); | |
| $('#agree').click(function(){ | |
| if($(this).is(':checked')) { | |
| $('.btn').removeAttr('disabled').addClass('btn-primary'); | |
| } else { | |
| $('.btn').attr('disabled', 'disabled').removeClass('btn-primary'); | |
| } | |
| }); | |
| }); | |
| </script> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creating jQuery function that disable submit button when user didn't check the check-box field.