[ jQuery ] Checkbox Controller


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

Select all checkbox in the specific context.
Need jQuery Framework : http://jquery.com/


Copy this code and paste it in your HTML
  1. // context = id of elements which contains checkboxes
  2. // controller = DOMelement of ckeckbox controller
  3. function checkall(context, controller){
  4. $("#"+context).find("input[@type$='checkbox']").not(controller).each(function(){
  5. // verify the state of checkbox controller and pass the state to others checkboxes
  6. this.checked = $(controller).checked;
  7. });
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.