Javascript examples for DOM:Element innerHTML
Remove child element but keep its content
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w. java2 s .c o m var x = document.getElementById("test"); var y = document.getElementById("testChild").innerHTML; x.addEventListener('click', function () { this.innerHTML = y; }) } </script> </head> <body> <span id="test"> <strong id="testChild">Test without styles</strong> </span> </body> </html>