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 19

How do you take breaks throughout the day?

How often, and what do you during them?

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

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️