How to toggle all checkbox on a page

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

Copy this code and paste it in your HTML
  1. //---- How to Toggle All the checkboxes on a page
  2. var tog = false; // or true if they are checked on load
  3. $('a').click(function() {
  4. $("input[type=checkbox]").attr("checked",!tog);
  5. tog = !tog;
  6. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.