[英]Javascript, jQuery element selectors
I can't understand what this selector selects actually:我无法理解这个选择器实际上选择了什么:
var x=$("a[href*='y']")
Could you guys explain it me in plain English.你们能不能用简单的英语给我解释一下。
Thanx in advance Dhiaa提前感谢 Dhiaa
*=
means contains, so in this case it is selecting all anchor ( a
) tags that contain y
*=
表示包含,所以在这种情况下它选择所有包含y
锚 ( a
) 标签
See documentation on jquery selectors here.请在此处查看有关 jquery 选择器的文档。
This selector selects an with attribute, contains href='y'.这个选择器选择一个 with 属性,包含 href='y'。 That means that you select some link () which leads (href) to y这意味着您选择了一些将 (href) 引向 y 的链接 ()
Read more about jq attributes here https://api.jquery.com/category/selectors/attribute-selectors/在此处阅读有关 jq 属性的更多信息https://api.jquery.com/category/selectors/attribute-selectors/
它选择每个 href 属性值包含“y”的元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.