--- title: Element.removeAttributeNS() slug: Web/API/Element/removeAttributeNS translation_of: Web/API/Element/removeAttributeNS ---

{{ APIRef("DOM") }}

removeAttributeNS 移除元素的指定属性

在Firefox 3及更高版本中,此方法会将DOM值重置为其默认值。

用法

element.removeAttributeNS(namespace,attrName);

例子

// <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" />

Notes

{{ DOMAttributeMethods() }}

Specification

DOM Level 2 Core: removeAttributeNS