I want to combine these two jquery things: Disable/enable an input with jQuery? and JQuery check if checkbox is NOT checked
HTML:
<label>
<input type="checkbox" name="agreement"> I read all the information in the red box above and followed the instructions!
</label>
<br/>
<input disabled="disabled" type="submit" name="submit">
jQuery:
$( document ).ready(function() {
if($("input[name=agreement]").prop('checked') == true){
$("input[name=submit]").prop('disabled', false);
} else {
$("input[name=submit]").prop('disabled', true);
}
}
Demo: http://jsfiddle.net/Zoker/32w5kcf8/
But it does not work. Can anybody tell me why?