एक्सएमएल डोम एपेंडडेटा () विधि
पाठ वस्तु
उदाहरण
निम्नलिखित कोड खंड " books.xml " को xmlDoc में लोड करता है और पाठ को पहले <शीर्षक> तत्व में जोड़ता है:
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("title")[0].childNodes[0];
x.appendData(" Cooking");
document.getElementById("demo").innerHTML
=
x.data;
}
आउटपुट:
Everyday Italian Cooking
परिभाषा और उपयोग
एपेंडडेटा () विधि टेक्स्ट नोड के अंत में एक स्ट्रिंग जोड़ती है।
वाक्य - विन्यास
textNode.appendData(string)
Parameter | Description |
---|---|
string | Required. The string to add to the text node |
पाठ वस्तु