Listening for all checkboxes

A listener that alerts you when all checkboxes are checked.

by chapmanc

HTML

<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>
<input type="checkbox"  class="abc"/>

JavaScript

$("input[type='checkbox'].abc").change(function(){
    var a = $("input[type='checkbox'].abc");
    if(a.length == a.filter(":checked").length){
        alert('all checked');
    }
});