选择< a> href以一些字符串结尾 [英] Select <a> which href ends with some string

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

问题描述

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

例如,如果我想找到此链接<a href="http://server/page.aspx?id=ABC">

解决方案

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

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

对于属性:

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

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天全站免登陆