Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Dynamically checks and unchecks all the checkboxes in a form when a button is clicked. Much easier than manually hard-coding the checkbox names.


Make a selection
Java
JavaScript
ASP
HTML
SQL

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: checkAll.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

6. From: karan panchal
it is possibel to use this script for asp:checkboxlist
11/22/2008 01:52:09

Hi

I read your article but it like to know it is possibel to use this script for asp:checkboxlist.

pls send me details

Regards
karan panchal

7. From: Lee (Admin)
01/16/2009 10:30:45

Your question is beyond the scope of these comments. You will need to post it over on the JavaScript forum. Thanks!

4. From: robert
Solution with action?
11/19/2008 04:01:02

The action attribut is empty. However, usually one will have a action with a form. But then those check/uncheck all buttons would behave falsely.

So what would be a better solution in this case?

5. From: Lee (Admin)
12/02/2008 10:37:02

Robert,

There should be no reason why the method of processing the form would affect the usage of this script.

2. From: Ismael Torres
10/17/2008 22:19:32

the check all is working fine to select and unselect the checkboxes.. but when i change the name of the check box from: name='list' to name='list[ ]' to receive in $_POST as an array .. it does not work..

3. From: Lee (Admin)
11/06/2008 11:59:23

Your question is beyond the scope of these comments. You will need to post it over on the JavaScript forum. Thanks!

1. From: Ek
Thanks
01/08/2008 21:32:17

Thanks.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.