Posted By

smoothdzion on 01/04/10


Tagged

toggle jquery checkboxes


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

smoothdzion
StrawMan
jackkeller
wnasich
koyotebr
verostudios
mfigge
SpoodyGoon


jQuery - Toggle All Checkboxes


 / Published in: jQuery
 

URL: http://groups.google.com/group/jquery-en/browse_thread/thread/ded7aae58024220b

Great short snippet of code to toggle checkboxes. Thanks Josh Nathanson for putting this simple code together.

  1. var tog = false; // or true if they are checked on load
  2. $('a').click(function() {
  3. $("input[type=checkbox]").attr("checked",!tog);
  4. tog = !tog;
  5. });

Report this snippet  

You need to login to post a comment.