Exercise:
Use the DOM to find and display the document's title.
Hint
Syntax hint: document.title
Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <title>W3Schools Demo</title> </head> <body> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = "The title of this document is: "; </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <head> <title>W3Schools Demo</title> </head> <body> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = "The title of this document is: " + document.title; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy