实例
从所有的 <p> 元素移除样式属性:
$("button").click(function(){
$("p").removeAttr("style");
});
定义和用法
removeAttr() 方法从被选元素移除一个或多个属性。
语法
$(selector).removeAttr(attribute)
参数 | 描述 |
---|---|
attribute | 必需。规定要移除的一个或多个属性。如需移除若干个属性,请使用空格分隔属性名称。 |

更多实例
从被选元素移除若干个属性
如何从被选元素移除 id 和 class 属性。
其他扩展