Element: removeAttributeNS() 方法
Element 接口的 removeAttributeNS() 方法会移除元素上指定命名空间中指定的属性。
如果您正在处理 HTML,并且不需要将请求的属性指定为特定命名空间的一部分,请改用 removeAttribute() 方法。
语法
js
removeAttributeNS(namespace, attrName)
参数
返回值
无(undefined)。
示例
js
// Given:
// <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
// special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// Now: <div id="div1" width="200px" />
规范
| 规范 |
|---|
| DOM # ref-for-dom-element-removeattributens① |
浏览器兼容性
加载中…