How to check if checkbox is checked in jQuery?

checkbox is checked

There are many ways to check if a checkbox is checked or not:
Using Prop:

if($('#checkMeOut').prop('checked')) {
    // something when checked
} else {
    // something else when not

Using is() Method:


Using attribute selector:


Using click action:

$('#checkMeOut').click(function() {
  if (this.checked) {
  } else {

Using checked attribute:

if($("#checkMeOut").attr('checked') == true){

You can get more details about this topic from here.
To get to know more about other JQuery topics, you can check these articles too.

Please follow and like us:

Related Posts

Leave a Reply