Javascript DOM Node get children node

Description

Javascript DOM Node get children node

View in separate window

<!DOCTYPE html>

<html>
<head>
    <title>Sample Page</title>
</head>//from   w w  w . jav a2 s  . co m
<body>
    <p>This is some text.</p>
    <p>This is more text.</p>
    <p>Here is text with a <span id="foo">span element</span>.</p>
    <script type="text/javascript">
        let theSpan = document.getElementById("foo");

        theSpan.childNodes[0].nodeValue = "span element containing new text";
    </script>
</body>
</html>



PreviousNext

Related