Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Element Object</h1>
<h2>The firstChild Property</h2>
<p>Example list:</p>
<ul id="myList"><li>Coffee</li><li>Tea</li></ul>
<p>The HTML content of the list's first child node is:</p>
<p id="demo"></p>
<p>Whitespace between elements is considered text nodes.
If there is a whitespace before the first "li" element, the result will be "undefined".</p>
<script>
let text = document.getElementById("myList").firstChild.innerHTML;
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>