Checking and unchecking, or ticking and unticking if you prefer, checkboxes using jQuery is remarkably simple.
If you think about it, the checked attribute for a standard HTML checkbox is actually a deprecated “checked = true” and by leaving it out in your checkbox declaration, you are in actual fact setting “checked = false” on that input.
So in order to check a checkbox with jQuery you simple select the checkbox input to be affected and enter:
$('input[name=foo]').attr('checked', true);
Alternatively, to uncheck you actually physicall remove the checked attribute:
$('input[name=foo]').removeAttr('checked');
Pretty simple stuff eh? ;)
Related Posts :
Providing functionality to check all, uncheck all or even to invert the checkboxes currently sel ...
If you have a group of checkboxes on a page, sometimes it is quite nice to give the user some qu ...
If you develop websites and work with JavaScript, but have never heard of jQuery before, then it ...
Disabling a button on a webpage using jQuery is remarkable simple - just set the selected button ...
If you develop websites and work with JavaScript, but have never heard of jQuery before, then it ...






