Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  jQuery to check whether checkbox is checked

In Vanilla JavaScript, the correct way of checking whether a checkbox is checked is to get the property checked of the checkbox. Assuming there is an checkbox with id "checkbox1", below line will return true if the checkbox is checked while it will return false if the checkbox is unchecked:document.getElementById("checkbox1").checkedIn jQuery, there are a few ways to check this. The first one is to using the corresponding counterpart of the Vanilla JavaScript, it is to check the checked property.$("#checkbox1").prop("checked")The prop() method will get the value of a property for the firs...

15,199 1       JQUERY CHECKBOX CHECKED ATTR PROP