XML DOM removeAttributeNS() विधि
विन्यास और उपयोग
removeAttributeNS()
नामस्पेस और नाम के द्वारा निर्दिष्ट अट्रिब्यूट को हटाने के लिए विधि。
व्याकरण
elementNode.removeAttributeNS(ns,name)
पारामीटर | वर्णन |
---|---|
ns | अनिवार्य। अट्रिब्यूट के नामस्पेस को निर्दिष्ट करता है। |
name | अनिवार्य। अट्रिब्यूट के नाम को निर्दिष्ट करता है। |
उदाहरण
नीचे कोड "books_ns.xml" को xmlDoc में लोड करता है और पहले <title> एलीमेंट से "lang" अट्रिब्यूट हटा देता है:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books_ns.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; var x = xmlDoc.getElementsByTagName("title")[0]; var ns = "https://www.codew3c.com/meishi/"; document.getElementById("demo").innerHTML = "अट्रिब्यूट खोजा गया: " + x.hasAttributeNS(ns, \"lang\"); x.removeAttributeNS(ns, "lang"); document.getElementById("demo").innerHTML += "<br>गुण पाया: " + x.hasAttributeNS(ns, "lang"); }