Select all Checkboxes


/ Published in: jQuery

Selects all checkboxes and checks or unchecks them.
#chk_All = id(s) of the check box to add an onclick event for


Copy this code and paste it in your HTML
  1. $(document).ready(function(){
  2.  
  3. $("#chk_All").click(function()
  4. {
  5. var checked_status = this.checked;
  6. $("input[type='checkbox']").each(function()
  7. {
  8. this.checked = checked_status;
  9. });
  10. });
  11.  
  12. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.