jQuery - Toggle All Checkboxes


/ Published in: jQuery
Save to your folder(s)

Great short snippet of code to toggle checkboxes.
Thanks [Josh Nathanson](http://groups.google.com/groups/profile?enc_user=aAOlJRcAAAC7dB8ku2NsRGdjbPtXhPEXHqZiDvCVswhrZ6TQxKj0ww) for putting this simple code together.


Copy this code and paste it in your HTML
  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. });

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.