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