[ jQuery ] Checkbox Controller


 / Published in: JavaScript
 

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

  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  

You need to login to post a comment.