jQuery - multiple :not selector

Hill79 picture Hill79 · Aug 22, 2011 · Viewed 66.3k times · Source

I'm trying to target page-wide links that do not start with a '#' and do not include in-line javascript but I'm having problems figuring out how to structure the selector properly.

Based on what I've googled about multiple selectors this should work, both selectors work independently, just not together!

$('a:not([href*=javascript]), a:not([href^=#])')
.each(function(){...

Answer

jtbandes picture jtbandes · Aug 22, 2011

Try using

$('a:not([href*=javascript]):not([href^=#])') ...