1

i'm new to this dom im going to get the tha last child of this xml document but unable to get this can anybody explain why my code seems correct to me but but dont know why it is not getting the messages lastchild's, so what are the other possible ways to do this , i just want to get the talk 123

the xml file

<messages category="short">
<person1>
<time>
r
<message>Djssjs</message>
</time>
</person1>
<person2>
<time>
r
<message>1234fdg</message>
</time>
</person2>
<person1>
<time>
 r
<message> talk 123</message>
</time>
</person1>
</messages>

javascript

msg = getElementsByTagName("messages").lastChild.childNodes[1].nodeValue ; 
document.getElementById("demo").innerHTML = msg;
Anjali
  • 329
  • 2
  • 15
  • See this post for answer: https://stackoverflow.com/questions/13308906/selecting-a-last-child-in-javascript – Leth Aug 01 '18 at 13:27

0 Answers0