15 Oct 2009

JQuery and setting checkbox to checked except disabled ones....

Got a master checkbox that you want to control the toggling of a bunch of other checkboxes in a container (but only non-disabled ones)? Want to use JQuery to make it SUPER EASY?

$('#chkMasterCheckbox').click(function(event) {
$('#divContainer input[type=checkbox]:enabled').attr('checked', $(this).attr('checked'));
});


Oh yeah baby.

No comments:

Post a Comment

Comments are very welcome but are moderated to prevent spam.

If I helped you out today, you can buy me a beer below. Cheers!