Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript HTML DOM</h2> <p id="intro">Finding HTML Elements by Id</p> <p>This example demonstrates the <b>getElementsById</b> method.</p> <p id="demo"></p> <script> const element = document.getElementById("intro"); document.getElementById("demo").innerHTML = "The text from the intro paragraph is: " + element.innerHTML; </script> </body> </html>