Tuesday, January 16, 2007

Checkbox manipulation with jQuery

Updated my plugins for working with checkboxes http://www.texotela.co.uk/code/jquery/checkboxes/

Toggle, check, uncheck and make them behave like radio buttons.

Works with jQuery 1.0 and 1.1.

You supply the container, and optionally return the check items (if using toggleCheckboxes or checkCheckboxes) or unchecked items (unCheckCheckBoxes):

$("#mycontainer").toggleCheckboxes().doSomethingWithMyContainer();
$("#mycontainer").toggleCheckboxes("[@name=foo]", true).doSomethingWithCheckedBoxes();

For turning a checkbox group --> radio style selection:

$.radioCheckboxGroup("fieldname")

No comments: