XML DOM textContent Property
Complete Attr Object Reference
Definition and Usage
The textContent property sets or returns the textual content of an attribute.
Syntax
Example
The following code fragment loads "books.xml"
into xmlDoc using
loadXMLDoc() and returns the textual content of the category attributes:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].textContent);
document.write("<br />");
}
|
The output of the code above will be:
Try-It-Yourself Demos
textContent - Get the textual content of an attribute
textContent - Set the textual content of an attribute
Complete Attr Object Reference
|