Javascript examples for DOM HTML Element:Title
The text property sets or gets the text of the document's title.
Set the text property with the following Values
Value | Description |
---|---|
text | Sets the text of the document's title |
A String, representing the text of the document's title
The following code shows how to return the text of the document's title:
<!DOCTYPE html> <html> <head> <title>HTML DOM Objects</title> </head>/* w ww. j av a2s. co m*/ <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var v = document.getElementsByTagName("TITLE")[0].text =; document.getElementById("demo").innerHTML = v; } </script> </body> </html>