I want to be able to select all <a> tags which exactly match a given URL. If my target URL is http://www.example.com/foo, I want to match both:
<a href="http://www.example.com/foo">Blah</a>
<a href="http://www.example.com/foo?a=b">Blah</a>
I can’t just use $('a[href^="http://www.example.com/foo"]') since this also matches http://www.example.com/foo/bar.
Is this possible with selectors, or must I iterate over the links manually?
I believe this is what you are after…
Basically, this should get all links that start with URL. Then filter then to be sure that only the ones exactly matching or exactly matching AND have GET parameters are returned.
Here’s a jsfiddle proving it.