This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

head

Summary

Gets the head element of the document.

Property of dom/Documentdom/Document

Syntax

Note: This property is read-only.

var headElement = document.head;

Return Value

Returns an object of type DOM NodeDOM Node

The head element of the document.

Examples

This example displays the text (innerHTML) of the document’s head element.

<!DOCTYPE HTML>
<html>
<head>
<title>New Document</title>
<meta name="Generator" content="Notepad">
<meta name="Author" content="Bob Palindrome">
<meta name="Keywords" content="document head">
<meta name="Description" content="head property example">
</head>

<body>

<p onclick="alert(document.head.innerHTML)">Click me to see the contents of the <head> element</p>

</body>
</html>

Related specifications

W3C HTML5
Candidate Recommendation
WHATWG HTML
Living Standard

Attributions