Solution 1 :

You’re putting the :not at the wrong place, it’s part of the selector query not JS code

jQuery(document).ready(function() {
    $("#rad1 :checkbox").click(function() {

        $("div.abc1").show();
        $("#rad1 :checkbox:not(:checked)").each(function()  {
            $("." + $(this).val()).hide();
        });
    });
});

Problem :

my original script is this

<script type="text/javascript">
jQuery(document).ready(function(){
$("#rad1 :checkbox").click(function() {
       $("div.abc1").hide();
       $("#rad1 :checkbox:checked").each(function() {
           $("." + $(this).val()).show();
       });
    });
});
</script>

Which was made thanks to an answer by the user nnnnnn here

and as i stated in the title i was looking to invert the operation
ie. show everything and then hide all the elements that are not what is selected

after searching i found the :not() selector but i am having trouble implementing it

jQuery(document).ready(function() {
    $("#rad1 :checkbox").click(function() {

        $("div.abc1").show();
        $("#rad1 :checkbox:checked").each(function()  {
            $("." + (:not($(this))).val()).hide();
        });
    });
});

any help would be greatly appreciated.

Comments

Comment posted by evolutionxbox

$(":not(" + $(this) + ")")

By