Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.selector').each(function() {
- $(this).on('click', check);
- });
- $('.all').each(function() {
- $(this).on('click', all);
- });
- function all(event) {
- if($(this).is(':checked')){ $("input:checkbox:not(:checked)",$(this).parents('form')).not(this).prop("checked","checked");
- } else {
- $("input:checkbox(:checked)",$(this).parents('form')).not(this).prop("checked","");
- }
- //$('.selector').prop("checked", this.name === "SelectAll");
- check(event);
- }
- function check(event) {
- var checked = $(".selector:checked").map(function () {
- return this.name
- }).get()
- $('td').removeClass("highlight").filter(function () {
- return $.inArray($(this).text(), checked) >= 0
- }).addClass("highlight")
- if ($(this).is(".selector"))
- $('.all').not(this).prop("checked", false)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement