mardi 24 mai 2016

Jquery checkbox function backwards

Quick question. Can anyone tell me why this function is working backwards? For example, when I check it, it unchecks all of my checkboxes and when I uncheck it, it checks all of checkboxes.

The function was working fine until I added the .click() method at the end. However I need this so that the boxes call the function when clicked. Any help is appreciated!

Jquery:

 $("#checkAll").click(function () {
 $('input:checkbox').not(this).prop('checked', this.checked).click();
 });

HTML Master Checkbox:

<div id="masterButton">
        <input type="checkbox" id="checkAll" checked>Check/UnCheck All<br>
    </div>

HTML All other checkboxes:

<input id="bus0" type="checkbox" value="0">




Aucun commentaire:

Enregistrer un commentaire