Entry
How do I use the method comments()?
How do I use the method comments()?
Apr 9th, 2005 04:08
Martin Honnen,
The method comments takes no arguments and returns an XMLList with the
comment nodes which are children of this XML object:
XML.ignoreComments = false;
var gods = <gods>
<!-- Kibology for all. -->
<god>Kibo</god>
<!-- All for Kibology. -->
<god>Xibo</god>
</gods>;
var comments = gods.comments();
alert(comments.length()); // shows 2
alert(comments[0]); // shows '<!-- Kibology for all. -->'
alert(comments[1]); // shows '<!-- All for Kibology. -->'