Ilets assume i have the following HTML
<a class='x y'>A</a>
<a class='x '>B</a>
<a class='x '>C</a>
<a class='x y'>D</a>
how can I select all <a> that have class x => jQuery('a.x') and not class y without iterating with a loop to exclude them ?
Use the
:notselector, or the.not()method:Here’s a working example.