Search code examples
javascriptjqueryjquery-selectorssizzle

Sizzle.js ( JQuery Selector Engine ) error/bug


Well, I've been trying to make this, maybe I am constructing it wrong or it's a known bug in jquery selector :

$(':not(.class) > *').each( function(){

});

The code meant to get all elements expect those that are children of element with class .class :

<div class="class">
    <a> Hi 1 </a> <!-- This shouldn't be selected -->
</div>
<div class="something">
    <a> Hi 2 </a> <!-- This should be selected -->
</div>

Solution

  • Working fiddle

    I think that what you looking for :

    $(':not(.class *)').each( function(){
    
    });
    

    Hope this helps.