x.lastChild.nodeValue
Posted
by
Zeb-ur-Rehman
on Stack Overflow
See other posts from Stack Overflow
or by Zeb-ur-Rehman
Published on 2012-06-27T09:13:07Z
Indexed on
2012/06/27
9:15 UTC
Read the original article
Hit count: 264
last-child
<html>
<head>
<script type="text/javascript" src="jQuery.js">
<script type="text/javascript">
x=document.getElementByTagName("p");
document.write(x.lastChild.nodeValue);
</script>
</head>
<body>
<p id="intro">Hello World 1!</p>
<p id="intro">Hello World 2!</p>
<p id="intro">Hello World 3!</p>
</body>
</html>
Why doesn't the above code work. I want to show [Hello World 3!] by using the statement documetn.write(x.lastChild.nodeValue()); Thanks in advance...
© Stack Overflow or respective owner