How To Check All Checkboxes In A Form With Javascript

Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn

I had an application that had a long list of checkboxes in a form. I wanted the ability to check all the checkboxes at once, or uncheck them at once. However, after googling for a solution, it seemed that all of them required me to label all my checkboxes with the same name. The nature of my application didn’t allow me to do that, so I had to find my own solution.

The following Javascript code allows you to toggle (check or uncheck) all the checkboxes in your form. Just put this Javascript code chunk on a new line anywhere in the body of your webpage.


And you can use it with any form on your page, like this:

And here is a sample of how it works:





Similar Posts:

More to explorer

how i started being a minimalist

How I Started Being A Minimalist

Once, I thought that all that mattered in life were the things that you possessed. Things like your car, house, watch, clothes.

Leave a Reply

Your email address will not be published. Required fields are marked *