एचटीएमएल डोम हटाएं एट्रिब्यूट नोड () विधि
तत्व वस्तुउदाहरण
एक <h1> तत्व से वर्ग विशेषता नोड निकालें:
var elmnt = document.getElementsByTagName("H1")[0]; // Get the first <h1> element in the document
var attr = elmnt.getAttributeNode("class"); // Get the class attribute node from <h1>
elmnt.removeAttributeNode(attr); // Remove the class attribute node from <h1>
परिभाषा और उपयोग
removeAttributeNode() विधि किसी तत्व से निर्दिष्ट विशेषता को हटा देती है, और हटाए गए विशेषता को Attr Node ऑब्जेक्ट के रूप में लौटाती है ।
इस विधि और removeAttribute() विधि के बीच का अंतर यह है कि removeAttribute() विधि निर्दिष्ट नाम के साथ विशेषता को हटा देती है , जबकि यह विधि निर्दिष्ट Attr ऑब्जेक्ट को हटा देती है । परिणाम वही होगा। साथ ही, removeAttribute() मेथड का कोई रिटर्न वैल्यू नहीं है , जबकि यह मेथड हटाए गए एट्रीब्यूट को Attr ऑब्जेक्ट के रूप में लौटाता है।
युक्ति: किसी तत्व के विशेषता नोड को वापस करने के लिए getAttributeNode() विधि का उपयोग करें ।
युक्ति: किसी तत्व में विशेषता नोड जोड़ने के लिए setAttributeNode() विधि का उपयोग करें ।
ब्राउज़र समर्थन
Method | |||||
---|---|---|---|---|---|
removeAttributeNode() | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
element.removeAttributeNode(attributenode)
पैरामीटर मान
Parameter | Type | Description |
---|---|---|
attributenode | Attr object | Required. The attribute node you want to remove |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक Attr ऑब्जेक्ट, हटाए गए विशेषता नोड का प्रतिनिधित्व करता है |
---|---|
डोम संस्करण | कोर स्तर 1 तत्व वस्तु |
और ज्यादा उदाहरण
उदाहरण
एक <a> तत्व से href विशेषता नोड निकालें:
var elmnt = document.getElementById("myAnchor"); // Get the <a> element with id="myAnchor"
var attr = elmnt.getAttributeNode("href"); // Get the href attribute node from <a>
elmnt.removeAttributeNode(attr); // Remove the href attribute node from <a>
संबंधित पृष्ठ
HTML ट्यूटोरियल: HTML विशेषताएँ
HTML DOM संदर्भ: HTML DOM विशेषता वस्तु
एचटीएमएल डोम संदर्भ: हटाएं एट्रिब्यूट () विधि
HTML DOM संदर्भ: getAttributeNode () विधि
HTML DOM संदर्भ: setAttributeNode () विधि
तत्व वस्तु