Prev Demo
Find Elements Bytagname
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <body> <p>Hello DotNetFunda</p> <p>Hello TechFunda</p> <p id="demo"></p> <script> var x = document.getElementsByTagName("p"); document.getElementById("demo").innerHTML = 'The first paragraph is: ' + x[0].innerHTML; </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output