Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>DOM Nodes Example</title>
</head>
<body>
<div id="example">
<!-- This is a comment node -->
<p>This is a text node within an element node.</p>
</div>
<script>
let exampleDiv = document.getElementById('example');
exampleDiv.style.border = '2px solid blue'; // Highlight the div element
exampleDiv.style.padding = '10px';
</script>
</body>
</html>