element.removeAttributeNode
Summary
removeAttributeNode
removes the specified attribute from the current element.
Syntax
removedAttr =element.removeAttributeNode(attributeNode)
attributeNode
is theAttr
node that needs to be removed.removedAttr
is the removedAttr
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)