Javascript examples for DOM HTML Element:Paragraph
Update <p> in a function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w. j av a 2 s. c om document.getElementById("demo1").innerHTML="This is my test heading"; function displaytext() { document.getElementById("demo").innerHTML="This is from a javascipt function..."; } displaytext(); } </script> </head> <body> <p id="demo1">This is demo1.</p> <p id="demo">This is a paragraph.</p> </body> </html>