Select All Checkboxes with jQuery

twitter logo github logo ・1 min read

A quick little jQuery snippet in order to select all checkboxes in a list of checkboxes.

$("#selectAll").click(function(){
        $("input[type=checkbox]").prop('checked', $(this).prop('checked'));

});

Basically, on Click of the Select All checkbox, set all checkboxes' checked property to the value of the Select All checkbox's checked property. That way you can select or deselect all.

twitter logo DISCUSS
Classic DEV Post from Feb 25

The Best Way to Advance Your Career

Where I answer a query from one of my awesome readers about how to advance your career based on my experience.

Jack Harner profile image
I'm Jack! I make websites. I specialize in custom WordPress solutions. Let's Chat!