FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

HTML DOM doctype Property

Document Object Reference Document Object

Example

Get the doctype name of an HTML document:

var x = document.doctype.name;

The result of x will be:

html
Try it Yourself »

Definition and Usage

The doctype property returns the doctype of the HTML document, as a DocumentType object.

The DocumentType object has a name property, which returns the name of the doctype.

Note: If the document has no doctype specified, the return value is null.


Browser Support

Property
doctype Yes Yes Yes Yes Yes

Note: In Internet Explorer 8 and earlier, this property returns null for HTML and XHTML documents, and will only work for XML documents.


Syntax

document.doctype

Technical Details

Return Value: The document's doctype, as a DocumentType object
DOM Version Core Level 1 Document Object

Related Pages

HTML reference: HTML <!DOCTYPE> Declaration


Document Object Reference Document Object