Created
May 30, 2009 16:29
-
-
Save adamstac/120551 to your computer and use it in GitHub Desktop.
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
%h1 Terms of Service | |
%p You must agree to the TOS in order to submit this form. | |
%p | |
%input{:type => "checkbox", :id => "agree_to_tos"} | |
%p | |
= submit_tag "Process Payment", :id => "submit_if_agree_to_tos" |
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
// Disable the submit button if the TOS checkbox is un-checked | |
var checkbox = $('.check_box input#agree_to_tos'); | |
var submit = $('input#submit_if_agree_to_tos'); | |
submit.attr('disabled', 'disabled'); | |
checkbox.click(function() { | |
if( $(this).attr("checked") ) { | |
submit.removeAttr('disabled'); | |
} else { | |
submit.attr('disabled', 'disabled'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment