Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. $('.selector').each(function() {
  2. $(this).on('click', check);
  3. });
  4. $('.all').each(function() {
  5. $(this).on('click', all);
  6. });
  7.  
  8. function all(event) {
  9.  
  10. if($(this).is(':checked')){ $("input:checkbox:not(:checked)",$(this).parents('form')).not(this).prop("checked","checked");
  11. } else {
  12. $("input:checkbox(:checked)",$(this).parents('form')).not(this).prop("checked","");
  13. }
  14.  
  15. //$('.selector').prop("checked", this.name === "SelectAll");
  16.  
  17. check(event);
  18. }
  19.  
  20. function check(event) {
  21. var checked = $(".selector:checked").map(function () {
  22. return this.name
  23. }).get()
  24. $('td').removeClass("highlight").filter(function () {
  25. return $.inArray($(this).text(), checked) >= 0
  26. }).addClass("highlight")
  27. if ($(this).is(".selector"))
  28. $('.all').not(this).prop("checked", false)
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement