Javascript examples for DOM:Document head
The head property returns the <head> element of the current document.
A reference to the Head Object, which represents a <head> element
The following code shows how to get the id of the <head> element of the current document:
<!DOCTYPE html> <html> <head id="myHead"> <title>My title</title> </head>/*from w ww .j a v a2s.c om*/ <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.head.id; document.getElementById("demo").innerHTML = x; } </script> </body> </html>