查找具有属性的所有元素

时间:2014-10-01 13:54:15

标签: javascript jquery

我需要找到带有属性path的绘制SVG中的所有marker-end个元素。

我试过了:

$('path').attr("marker-end") // Returns undefined
$('path').prop("marker-end") // Returns undefined

更新

此外path元素not具有给定属性。

更新2

好的,得到了​​$('path:not([marker-end])')

1 个答案:

答案 0 :(得分:2)

请尝试以下操作:

$('path[marker-end]')
$('path[marker-end=value]")

换句话说,语法是:

$("path[ATTRIBUTE_NAME]")
相关问题