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;
    });
});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s