I have the following code which enables a button when the checkbox is checked.
http://jsfiddle.net/ERfWz/1/
The following is a snippet from the code I have in my
You can also set disabled
with true
and false
, so you can simplify it down to:
$(function() {
$('#agree').change(function() {
$('#submit').attr('disabled', !this.checked);
});
});
Test it out here, note there was also some invalid markup going on resulting in some cross-browser inconsistencies, it should look something like this:
Also the .change() method's a bit better here, to ensure you have the correct state.