Latest web development tutorials

HTML DOM doctype property

Document Object Reference Document Object

Examples

Back Document Type Object HTML document:

document.doctype;

try it"

Definition and Usage

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

Read more document types of knowledge objects, please see the document type Object Reference .

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support doctype property

Note: Internet Explorer 8 and earlier versions of IE displays HTML and XHTML documents that property returns null, but support for XML documents.


grammar

document.doctype

technical details

return value: Document type of the document as a DocumentType object.
DOM version Core Level 1 Document Object


Document Object Reference Document Object