removeAttr()

本页内容
上一节: Html_remove 下一节: Html_removeclass

jQuery removeAttr() 方法

jQuery HTML/CSS 方法

从所有的 <p> 元素移除样式属性:


示例

$("button").click(function(){
    $("p").removeAttr("style");
});

定义和用法

removeAttr() 方法从被选元素移除一个或多个属性。

语法

$(selector).removeAttr(attribute)
参数 描述
attribute 必需。规定要移除的一个或多个属性。如需移除若干个属性,请使用空格分隔属性名称。

更多实例

从被选元素移除若干个属性 如何从被选元素移除 id 和 class 属性。

jQuery HTML/CSS 方法

上一节: Html_remove 下一节: Html_removeclass
此页面最后编辑于2022年8月19日 (星期五) 11:45。