Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM doctype property

HTML DOM doctype property

Document Object Reference Document Object

Example

Return the document type object of the HTML document:

document.doctype;

Try it »


Definition and Usage

The doctype property returns the document type declaration (Document Type Declaration) associated with the document.

To read more about the document type object, see Document Type Object Reference Manual.

Note: If the document does not specify a document type, the return value is null.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the doctype property

Note: When displaying HTML and XHTML documents, Internet Explorer 8 and earlier IE versions return for this property null , but it supports XML documents.


Syntax

document.doctype

Technical Details

Return Value: The document type of the document, as a DocumentType object.
DOM version Core Level 1 Document object

Document Object Reference Document Object