I would like to have a form button disabled, until a user clicks a checkbox.
This is the code i have (last part of the form)
<div class="checkbox">
<input id="check" name="checkbox" type="checkbox">
<label for="checkbox">
Some Text Here
</label>
</div>
<input type="submit" name="anmelden" class="button" id="btncheck" value="Send" />
I tried the following
$('#check').click(function(){
if($(this).attr('checked') == false){
$('#btncheck').attr("disabled","disabled");
}
else
$('#btncheck').removeAttr('disabled');
});
But this is not working and I am not sure why. I don't know how I can disable the button (should be disabled also visually).
Solution (thanks to Rory McCrossan): http://jsfiddle.net/0hvtgveh/