Select <a> which href ends with some string

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">


   $('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
~= is contains word
|= is starts with prefix (i.e., |= "prefix" matches "prefix-...")

$('a[href$="ABC"]:first').attr('title');

这将返回具有以“ABC”结尾的URL的第一个链接的标题。


$("a[href*='id=ABC']").addClass('active_jquery_menu');
链接地址: http://www.djcxy.com/p/12418.html

上一篇: jQuery简单的滑块问题,在timeOut

下一篇: 选择<a>哪个href以某个字符串结尾