jQuery : Select All Checkbox


Yahoo! Mail and GMail both has a checkbox on top of their email list which will “checked” all chekboxes when clicked. Previously I use plain old javascript like those in this link, I just try to use jQuery to do this, its only 5 lines

$('#selectAll').click(function(event){
    $('input[type="checkbox"]').each(function(){
        this.checked = event.target.checked;
    });
});
Advertisements