I want to be able to select all elements that only have a single (given) class (and no other)
for example, let’s say my page looks like this
<html>
<body>
<div class="a"> </div>
<div class="a b"></div>
<div class="c"></div>
</body>
</html>
I want to be able to select only the first element – because it has a single class “a”, and no other classes.
Thanks
How about this:
or as @Hexa propsed:
http://jsfiddle.net/taYWP/
@Hexa: and it’s actually the fastest! 😉 http://jsperf.com/attr-vs-attr-and-class