Element item() Method - Use childNodes[index] to access child node - Javascript DOM

Javascript examples for DOM:Element item

Description

Element item() Method - Use childNodes[index] to access child node

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body><p>This is the first p element in body.</p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/* w w  w. ja va  2s  . c o m*/
    document.body.childNodes[0].innerHTML = "Changed!";
}
</script>

</body>
</html>

Related Tutorials