jQuery [attribute$=value] 選擇器

jQuery 選擇器 jQuery 選擇器

實例

選取所有帶有以 ".org" 結尾的 href 屬性的 <a> 元素:

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


定義和用法

[attribute$=value] 選擇器選取每個帶有指定屬性且以指定字串結尾的元素。


語法

$("[attribute$='value']")

參數 描述
attribute 必需。規定要查找的屬性。
value 必需。規定屬性值以其結尾的字串。


jQuery 選擇器 jQuery 選擇器