JQuery: How to Validate Checkbox whether the Checkbox is Checked or Unchecked

Our Reader Score
[Total: 0 Average: 0]
 jquery checkbox is checked or unchecked: This article explains how to get the checkbox checked status, or validate whether the checkbox is checked or unchecked in jQuery. In other words, how to test the state of checkbox i.e. whether the checkbox is checked or unchecked in jQuery.  Here we use jquery .is() method and matched checked attribute.

Description: The method .is() Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.


Here we have a checkbox control and a button tag, so our HTML look like as shown below:


jQuery:  Using .is(“:checked”)  method will return boolean value

So now below written jQuery code, will display checkbox status .i.e whether the checkbox is checked or unchecked on button click.

In above code 1st, we stored the checkbox control in a variable, which we use when button click function trigger, basically assigning variable to control (selector)is good practice for performance wise, i.e. caching the control.

Next we use .is(“:checked”) this return Boolean value. As a result, we got to know our checkbox current status,  checked or unchecked.

Try It Yourself ⇒

Get your Printable Copy