![jQuery [attribute] 属性选择器](https://cdn.div.cn/static/images/4f517b8523619fbcc96f6e3cfbf57dc9.png)
[ attribute ]选择器用于选择具有指定属性的[attribute]元素。
语法:
$("[attribute]")实例
选择具有target属性的每个元素:
$(document).ready(function(){
$("[target]").css({"background":"green", "color":"white"});
});测试看看‹/›参数值
| 参数 | 描述 |
|---|---|
| attribute | 指定要选择的元素的属性 |
![jQuery [attribute] 属性选择器](https://cdn.div.cn/static/images/4f517b8523619fbcc96f6e3cfbf57dc9.png)
[ attribute ]选择器用于选择具有指定属性的[attribute]元素。
$("[attribute]")选择具有target属性的每个元素:
$(document).ready(function(){
$("[target]").css({"background":"green", "color":"white"});
});测试看看‹/›| 参数 | 描述 |
|---|---|
| attribute | 指定要选择的元素的属性 |