To get the checked elements from a group of checkboxes you can use the select and css3 selectors shortcut:
var checked_el=surrounding_el.select('input:checked').each(function(checked_el) {
//do something with only the selected elements
alert("checked_element: "+checked_element.id);
});
/*
checked_el is a array holding the found elements
surrounding_el is a fieldset or div that encloses the checked boxes
select('input:checked') - select all with a CSS3 seletor type
of checked (http://www.w3.org/TR/css3-selectors/)
.each(function(checked_el) - loops on all the ones that are found
*/
Wednesday, 5 March 2008
Subscribe to:
Posts (Atom)