HTML DOM doctype property
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





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