HTML DOM removeAttribute() 方法Hello WorldHello World 元素对象
删除头部元素的 style 属性:
document.getElementsByTagName("H1")[0].removeAttribute("style");
删除属性前:
删除属性后:
removeAttribute() 方法删除指定的属性
查看类似方法
removeAttributeNode() 。
HTML DOM removeAttribute() 方法Hello WorldHello World
HTML DOM removeAttribute() 方法Hello WorldHello World
HTML DOM removeAttribute() 方法Hello WorldHello World
HTML DOM removeAttribute() 方法Hello WorldHello World
HTML DOM removeAttribute() 方法Hello WorldHello World 所有主要浏览器都支持 removeAttribute() 方法
element.removeAttribute(attributename)
参数
类型
描述
attributename
String
必需。规定要删除的属性的名称。
没有返回值。
DOM 版本
Core Level 1 Element Object
HTML DOM removeAttribute() 方法Hello WorldHello World