Select All Checkboxes with jQuery

jackharner

Jack Harner 🚀

Posted on April 26, 2019

Select All Checkboxes with jQuery

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

});
Enter fullscreen mode Exit fullscreen mode

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.

💖 💪 🙅 🚩
jackharner
Jack Harner 🚀

Posted on April 26, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Select All Checkboxes with jQuery
codepen Select All Checkboxes with jQuery

April 26, 2019