[英]How to target a title attribute in a link with jQuery?
I am trying to hide the title of a link popping out in firefox but I am getting an error if I do the following: 我试图隐藏在Firefox中弹出的链接的标题,但是如果执行以下操作,则会收到错误消息:
$('a["title"]').on('mouseenter', function(e){
e.preventDefault();
});
Console 安慰
Uncaught Error: Syntax error, unrecognized expression: a["title"]
未捕获的错误:语法错误,无法识别的表达式:a [“ title”]
Omit the double quotes in the attribute selector. 在属性选择器中省略双引号。 It should be
a[title]
: 应该是
a[title]
:
$('a[title]').on('mouseenter', function(e){
e.preventDefault();
});
The quotes usually represent an attribute's value. 引号通常表示属性的值。 For instance,
a[title="value"]
. 例如,
a[title="value"]
。
For further reference, the correct syntax for an attribute selector can be found here . 为了进一步参考, 可以在此处找到属性选择器的正确语法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.