HTML DOM Document doctype property

Definition and usage

doctype The property returns the doctype of the document (as a DocumentType object).

If the document does not have a doctype, then doctype The property returns null.

doctype The property is read-only.

doctype.name The property returns the name of the doctype.

See also:

HTML <!DOCTYPE> Declaration

Example

Get the doctype name of the HTML document:

const doctypeObj = document.doctype.name;

Try it yourself

Syntax

document.doctype

Return value

Type Description
Object DocumentType object.

Browser support

document.doctype It is a feature of DOM Level 1 (1998).

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support