There are two ways to check or uncheck checkbox using jQuery
1. The first one by using property
1. The first one by using property
// to check
$('#theCheckbox').prop('checked',true)
// to uncheck
$('#theCheckbox').prop('checked',false)
This sets the property like:
checkboxObject.checked=true;
2. The second one by using attribute
// to check
$('#theCheckbox').attr('checked','checked')
// to uncheck
$('#theCheckbox').removeAttr('checked')
No comments:
Post a Comment