XML DOM removeAttribute() विधि
वर्णन और उपयोग
removeAttribute()
मथड़ा
यदि DTD में अट्रिब्यूट का डिफ़ॉल्ट मान परिभाषित है, तो तुरंत डिफ़ॉल्ट मान वाला नया अट्रिब्यूट दिखाई देगा。
व्याकरण
elementNode.removeAttribute(name)
पारामीटर | वर्णन |
---|---|
name | अनिवार्य。 |
उदाहरण
इस कोड के माध्यम से "books.xml" को xmlDoc में लोड किया जाएगा और सभी <book> एलीमेंट से "category" अट्रिब्यूट अदूर किया जाएगा:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; var x = xmlDoc.getElementsByTagName("book"); document.getElementById("demo").innerHTML = x[0].getAttribute('category') + "<br>"; x[0].removeAttribute('category'); document.getElementById("demo").innerHTML +=; x[0].getAttribute('category'); }