uncheck all checkboxes except the one with a class?

Posted by Dejan.S on Stack Overflow See other posts from Stack Overflow or by Dejan.S
Published on 2010-05-28T14:13:59Z Indexed on 2010/05/28 14:22 UTC
Read the original article Hit count: 178

Filed under:

hi i try to check/uncheck all checkboxes that don't got a class to them. This is the code I got but it check the class boxes to.

$(document).ready(function() {
        $('#ctl00_ContentPlaceHolder1_repReceivers_ctl00_chxAll').click(
         function() {
        if (!$("input[type='checkbox']").hasClass("testclass")) {
             $("input[type='checkbox']").attr('checked', $('#ctl00_ContentPlaceHolder1_repReceivers_ctl00_chxAll').is(':checked'));
         }});
    });

any ideas where I go wrong?

© Stack Overflow or respective owner

Related posts about jQuery