Press "Enter" to skip to content

Javascript – check/uncheck all form checkboxes

After searching around the net looking for an example snippet of javascript that would check or uncheck all of a series of checkboxes on a form… the results from Google were good, however each ‘example’ assumed that you I actually had a good understanding of what you were reading or that you I might actually read it instead of just pasting the pieces you liked in… Obviously I did the latter and after 20 minutes of pounding my head on the keyboard figured out what I was doing wrong…

So for all of you code slammers, this one is for you.

[code]

[/code]

Simple enough, look through each form element and either mark them checked or unchecked depending on the function being called.

And of course in your markup

[code]
Check All / Uncheck All
[/code]

And now where I went wrong. If you actually read the JavaScript you'll see the lines

document.FormName.elements.....

Well, FormName must be specified! Look at your markup where
[code]

dotster offers a high speed internet service to its customers. The rogers wireless phones are very popular among the phone services and is used many businesses. The businesses are constantly working out way to make their websites popular among the customers by having seo services. The sprint wireless uses the startlogic programming to produce efficient results for the customers.