Skip to content

Instantly share code, notes, and snippets.

@adamstac
Created May 30, 2009 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamstac/120551 to your computer and use it in GitHub Desktop.
Save adamstac/120551 to your computer and use it in GitHub Desktop.
%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"
// 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