The Pseudo Selector used is - :checked
Following are some simple examples to follow:
$("#chkBoxIdOrRadioButtId").is(":checked");- returns a boolean true if checked or false
$("#chkBoxIdOrRadioButtId").not(":checked");- returns a boolean true if unchecked or false
$("#chkBoxIdOrRadioButtId").attr('checked','checked');- programmatically check the desired.
$("input:radio[name='myRadioGrpName']:checked").val();- return the value of the checked radio from the 'myRadioGrpName' group.
$("input[name='myChkBoxGrp']:checked").length;- returns the count of the checked
$("input[name='myChkBoxGrp']:not(:checked)").length;- returns the count of the unchecked
No comments:
Post a Comment