tags:

views:

15398

answers:

3

Hi,

Is it possible using jQuery to select all <a> links which href ends with "ABC"

for example, if i want to find this link <a href="http://server/page.aspx?id=ABC"&gt;

Thanks in advance

+62  A: 
   $('a[href$="ABC"]')...

Selector documentation can be found at http://docs.jquery.com/Selectors

For attributes:

= is exactly equal
!= is not equal
^= is starts with
$= is ends with
*= is contains
tvanfosson
Awesome, exactly what I needed. Thanks!
Swingley
+1 for detail, great answer
Doug
A: 
$('a[href$="ABC"]:first').attr('title');

This will return the title of the first link that has a URL which contains "ABC".

Ash
A: 

thank Ash. i got it

Tung