选择<a>其中 href 以某个字符串结尾 [英] Select <a> which href ends with some string

查看:25
本文介绍了选择<a>其中 href 以某个字符串结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 jQuery 来选择所有以 href 结尾的 链接用ABC"?

例如,如果我想找到这个链接

 $('a[href$="ABC"]')...

选择器文档可以在 http://docs.jquery.com/Selectors

对于属性:

= 完全相等!= 不相等^= 以$= 以*= 是包含~= 是包含单词|= 以前缀开头(即 |= "prefix" 匹配 "prefix-...")

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

这篇关于选择&lt;a&gt;其中 href 以某个字符串结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆