vendredi 2 juin 2017

How can I check all checkboxes except the disabled ones?

If I click on checkAll I want to check all checkboxes except the disabled ones.

$("#checkAll").click(function () {
  $(".projectlist input:checkbox").each(function () { 
    if($(this).is(':enabled')){
     $('.projectlist input:checkbox').not(this).prop('checked', this.checked);
  }
 });
});
<script src="http://ift.tt/1oMJErh"></script>

<div class="projectlist">
<input id="checkAll" type="checkbox"><br>
<input disabled type="checkbox"><br>
<input disabled type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
</div>



Aucun commentaire:

Enregistrer un commentaire