Various plugins for working with checkboxes.
These plugins behave differently than the previous version, which is still available for download. The first parameter is for only toggling/checking/unchecking checkboxes that match the expression (you can use :not(#checkbox1) for filtering out items). radioCheckboxGroup has also been updated to allow selection by jQuery expression (i.e. class name) as well as name. The last 5 checkboxes in the table below behave like radio buttons. They can still be checked via JavaScript though.
This plugin is available for download via jQuery SVN
Use: $("#myform").toggleCheckboxes(); to toggle all checkboxes in '#myform'.
Ignore checkboxes matching a jQuery expression : $("#myform").toggleCheckboxes(":not(#checkbox1)");
Return the checked items: $("#myform").toggleCheckboxes(".top5", true);
(use "*" instead of ".top5" if you want to toggle all of them)
Use: $("#myform").checkCheckboxes(); to check all checkboxes in '#myform'.
Ignore checkboxes matching a jQuery expression : $("#myform").checkCheckboxes(":not(#checkbox1)");
Return the checked items: $("#myform").checkCheckboxes(".top5", true);
(use "*" instead of ".top5" if you want to check all of them)
Use: $("#myform").unCheckCheckboxes(); to uncheck all checkboxes in '#myform'.
Ignore checkboxes matching a jQuery expression : $("#myform").unCheckCheckboxes(":not(#checkbox1)");
Return the unchecked items: $("#myform").unCheckCheckboxes(".top5", true);
(use "*" instead of ".top5" if you want to uncheck all of them)
Makes all checkboxes with the given name behave like a radio button list. Code was originally written by 'Rob D' in an email sent to me.
Use: $.radioCheckboxGroup("name").
You can also filter using an expression: $.radioCheckboxGroup("name", ".myclass");
If you use a blank string "", or null instead of "name", it will apply to all checkboxes on the page.
The checkboxes that this is applied to can still be checked via JavaScript (i.e. using toggleCheckboxes or checkCheckboxes).