XML DOM textContent Property
Attr object
Definition and Usage
The textContent property sets or returns the textual content of an attribute.
Syntax
attrObject.textContent
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and return the textual content of the category attribute:
Example
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
(
"
"
)
;
}
Output:
COOKING
CHILDREN
WEB
WEB
Try it »
Try it
textContent - Set the text content of an attribute
Attr object