Skip to main content

Posts

Showing posts with the label Checkbox

Check a checkbox using jQuery or JavaScript?

To check this you can Use the new .prop() function: $('.chkTest').prop('checked', true); $('.chkTest').prop('checked', false); But it will work only injQuery 1.6 and above.  To check in jQuery 1.5 and below versions you need to use .attr(). To check the checkbox (by setting the value of the checked attribute) do $('.chkTest').attr('checked','checked'); and for un-checking (by removing the attribute entirely) do