Latest web development tutorials
 

HTML DOM head Propery

< Document Object

Example

Get the id of the <head> element of the current document:

var x = document.head.id;

The result of x will be:

myHead
Try it Yourself »

Definition and Usage

The head property returns the <head> element of the current document.

Note: If there are more than one <head> element in the document, this property returns the first one.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
head 4.0 9.0 4.0 5.0 11.0

Syntax

document.head

Technical Details

Return Value: A reference to the Head Object, which represents a <head> element
DOM Version Core Level 3 Document Object

Related Pages

HTML reference: HTML <head> tag

JavaScript reference: HTML DOM Head Object


< Document Object