element.removeAttributeNode

Summary

removeAttributeNode removes the specified attribute from the current element.

Syntax

removedAttr =element.removeAttributeNode(attributeNode)
  • attributeNode is the Attr node that needs to be removed.
  • removedAttr is the removed Attr node.

Example

// <div id="top" align="center" />
var d = document.getElementById("top");
var d_align = d.getAttributeNode("align");
d.removeAttributeNode(d_align);
// align has a default value, center,
// so the removed attribute is immediately
// replaced: <div id="top" align="center" />

Notes

If the removed Attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.

DOM ใƒกใ‚ฝใƒƒใƒ‰ใฏ่ฆ็ด ใฎๅฑžๆ€งใ‚’ๅ–ใ‚Šๆ‰ฑใ„ใพใ™ใ€‚

ๅๅ‰็ฉบ้–“ใซ็„ก้–ขไฟ‚ใ€
ๆœ€ใ‚‚ไธ€่ˆฌ็š„ใซไฝฟ็”จใ•ใ‚Œใ‚‹ใƒกใ‚ฝใƒƒใƒ‰
ๅๅ‰็ฉบ้–“ใซ้™ๅฎšใ•ใ‚Œใ‚‹ๅค‰ๆ•ฐ
(DOM Level 2)
Attr ใƒŽใƒผใƒ‰ใ‚’็›ดๆŽฅๆ‰ฑใ† DOM ใƒฌใƒ™ใƒซ 1 ใฎใƒกใ‚ฝใƒƒใƒ‰
(ใปใจใ‚“ใฉไฝฟ็”จใ•ใ‚Œใชใ„)
Attr ใƒŽใƒผใƒ‰ใ‚’็›ดๆŽฅๆ‰ฑใ† DOM ใƒฌใƒ™ใƒซ 2 ๅๅ‰็ฉบ้–“ใซ้™ๅฎšใ•ใ‚Œใ‚‹ใƒกใ‚ฝใƒƒใƒ‰
(ใปใจใ‚“ใฉไฝฟ็”จใ•ใ‚Œใชใ„)
setAttribute (DOM 1) setAttributeNS setAttributeNode setAttributeNodeNS
getAttribute (DOM 1) getAttributeNS getAttributeNode getAttributeNodeNS
hasAttribute (DOM 2) hasAttributeNS - -
removeAttribute (DOM 1) removeAttributeNS removeAttributeNode -

Specification

DOM Level 2 Core: removeAttributeNode (introduced in DOM Level 1 Core)