How to select anchor tag with specified class and rel?

daGrevis picture daGrevis · Jul 27, 2011 · Viewed 25.6k times · Source

I have an anchor tag like this, and I need to select it!

<a href="#" class="foo bar" rel="123">...</a>

Is it possible with jQuery to write a selector that selects an anchor that has class like foo bar and rel like 123?

Answer

Qtax picture Qtax · Jul 27, 2011

You can use something like:

$('a.foo.bar[rel="123"]')