How to check whether a checkbox is checked in jQuery

check whether checkbox is checked

Here is a simple example to check the checked property of a checkbox and perform an action based on the checked property using jQuery. For example if the “courseSelected” checkbox  is checked, then we need to show a textbox to enter course, else hide the textbox.

If you are looking for check or un-check all checkboxes using JavaScript or jQuery, Please refer my previous article on Example to Check All or Uncheck All Using JavaScript and jQuery.

In normal javascript we can get the checked property of a checkbox DOM element will give you the checked state of the checkbox element like below

var checkedVal = document.getElementById(‘courseSelected’).checked;

So the above line will return the current state of the courseSelected element.

Below is the jQuery code to show course textbox when courseSelected checkbox is checked.

if($('#isAgeSelected').attr('checked')) {
} else {

We are always happy to help our visitors so please do comment for any help in JavaScript or jQuery or any other technology.

You may also like...