Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery is attr update on checkbox is not triggering change event

I have a couple of checkboxes and a status box that tells you if at least 1 of the checkboxes are checked.

I also have a check All/None checkbox which works in toggling the checkboxes but it is not triggering the change event that is assigned to each of the checkboxes so the status never gets updated if the check All/None checkbox is used.

Here is my implementation:

http://jsfiddle.net/axl163/Fckvd/1/

like image 311
Allen Liu Avatar asked May 24 '12 19:05

Allen Liu


1 Answers

function toggleChecked(status) {
    $(".chkbx").each( function() {
        $(this).prop("checked", status).change(); // you have to trigger the event
    });
}

DEMO

like image 178
thecodeparadox Avatar answered Oct 09 '22 17:10

thecodeparadox