File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Check box manager: critique my jQuery plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Check box manager: critique my jQuery plugin" Watch "Check box manager: critique my jQuery plugin" New topic
Author

Check box manager: critique my jQuery plugin

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2833
    
  11

I needed a way to take a set of check boxes and associate them with another check box that would act as a "check all" for them. My goals were:

1. Checking the "check all" check box will check all the managed check boxes
2. Unchecking the "check all" check box will uncheck all the managed check boxes
3. The "check all" check box will checked, unchecked, or indeterminate depending if all, none, or some of the managed checkboxes are checked.
4. An optional callback function can be provided, which will be called when the "check all" or a managed check box is checked or unchecked, but after all the states are updated. It will be passed the set of all checked managed check boxes.

So, I looked through the existing plugins, but I didn't look too hard, because I wanted an excuse to do it myself. Here's what I've got:



Here's some code where I test it:




On the positive side, it does work. However, I'm still an advanced beginner with jQuery and I'm terrible at JavaScript, so I'm probably making all sorts of dangerous mistakes and other bad choices. I could really use your expert opinions!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check box manager: critique my jQuery plugin
 
Similar Threads
How to setup a single checkbox to toggle / untoggle other check boxes?
struts, .click, names, jQuery
JSON Syntax error
Check All button for all spring check boxes array
Dynamic form/checkbox problem