Javascript examples for DOM:Element innerHTML
Element innerHTML Property - Get the HTML content of a <p> element with id="myP":
<!DOCTYPE html> <html> <body> <p id="myP">I am a paragraph.</p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w.j a v a2 s.c om*/ var x = document.getElementById("myP").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>