Toggle a checkbox using jQuery
If you're using jQuery and you need to toggle a checkbox, add this onclick code to an object:
onclick="$('#id_of_checkbox').attr('checked',!$('#id_of_checkbox').attr('checked'));"
The above code sets the "checked" attribute of the checkbox to the opposite of itself, i.e. checked -> unchecked or unchecked -> checked.
onclick="$('#id_of_checkbox').attr('checked',!$('#id_of_checkbox').attr('checked'));"
The above code sets the "checked" attribute of the checkbox to the opposite of itself, i.e. checked -> unchecked or unchecked -> checked.
