How to read a checkbox status using jQuery?

Check boxes are very common in HTML forms and is used to get multiple options.

How can we read a checkbox field or how to check whether a checkbox field is checked or not.

We can do it with the help of jQuery. If your HTML document is jQuery enabled you can use the following way.

$(document).ready(function () {
$("#checkbtn").click(function () {
if ($('#check1').is(':checked')) {
} else {
alert("not checked");
<input type='checkbox' id='check1' />
<input type='button' id='checkbtn' value='check' />

So, $(‘#checkbox’).is(‘:checked’) will returun a true if check box is checked else it return a false value


Article Categories:
HTML & CSS · JavaScript · Programming · Web

Leave a Comment

Your email address will not be published. Required fields are marked *