TUTORIAL前端与浏览器FETCHED
jQuery removeAttr() 方法
jQuery removeAttr() 方法 jQuery HTML/CSS 方法 实例 从所有的 <p> 元素移除样式属性: [mycode3 type='js'] $('button').click(function(){ $('p').removeAttr('style'); }); [/mycode3] 尝..
更新于 2026/7/16
教程详情页默认 noindex。
jQuery removeAttr() 方法
定义和用法
removeAttr() 方法从被选元素移除一个或多个属性。
语法
$(selector).removeAttr(attribute)
| 参数 | 描述 |
|---|---|
| attribute | 必需。规定要移除的一个或多个属性。如需移除若干个属性,请使用空格分隔属性名称。 |
更多实例
从被选元素移除若干个属性
如何从被选元素移除 id 和 class 属性。
jQuery HTML/CSS 方法