jQuery [attribute]选择器|带有指定属性的元素
定义与用法
[attribute] 选择器选取带有指定属性的每个元素。
语法格式
$(“[ attribute]”)
示例代码
选取带有 id 属性的每个元素:
$("[id]")
参数说明
参数 | 描述 |
---|---|
attribute | 必需。规定要查找的属性。 |
[attribute] 选择器选取带有指定属性的每个元素。
$(“[ attribute]”)
选取带有 id 属性的每个元素:
$("[id]")
参数 | 描述 |
---|---|
attribute | 必需。规定要查找的属性。 |