In my previous post, you had learned how to set and get form element values using JQuery.
Example html form
- <input type=“checkbox” name=“city” id=“city” value=“Newyork” />
check and uncheck checkbox using JQuery
There are several ways to check and uncheck checkbox with jQuery. The element attribute will return true if it’s checked or false if it’s not.
Below is the example code of JQuery to check a checkbox:
Use below code to if you have not set element id
and like so to uncheck the checkbox: