[英]How to target a title attribute in a link with jQuery?
我試圖隱藏在Firefox中彈出的鏈接的標題,但是如果執行以下操作,則會收到錯誤消息:
$('a["title"]').on('mouseenter', function(e){
e.preventDefault();
});
安慰
未捕獲的錯誤:語法錯誤,無法識別的表達式:a [“ title”]
在屬性選擇器中省略雙引號。 應該是a[title]
:
$('a[title]').on('mouseenter', function(e){
e.preventDefault();
});
引號通常表示屬性的值。 例如, a[title="value"]
。
為了進一步參考, 可以在此處找到屬性選擇器的正確語法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.