Javascript examples for DOM:Element nextSibling
Setting innerHTML of nextSibling
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function replaceNextChild(element) { do {/*from w w w . j a va 2 s . co m*/ element = element.nextSibling; } while (element.nodeType != 1); element.innerHTML = "this is a test"; } </script> </head> <body> <h3 onclick="replaceNextChild(this);">Some content...</h3> (text node) <div> Div that I am interested in replacing </div> </body> </html>