In jQuery sometime you have to work with checkboxes. Find a checkbox by its attributes, Check a checkbox is checked or not and check a checkbox. Their are some related tricks.
Find checkboxes:
$('input[type="checkbox"]') (get all checkboxes)
$('input[name="mycb"]') (get checkbox named mycb)
Get checkboxes Attributes:
$('#myCheckbox').attr('name') (return name of checkbox)
$('#myCheckbox').attr('checked') (return true or false)
Checked or Not:
$('#myCheckbox').is(':checked') (return true if checked)
Check/Uncheck a Checkbox:
$('input[name="mycb"]').attr("checked",false); (uncheck named mycb)
$('input[type="checkboxes"]').attr("checked",true); (check all)
Saturday, August 1, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment