English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM doctype Property

HTML DOM Document Object

DOCTYPERead-only properties return the document type declaration (DTD) associated with the current document.

The returned object implements the DocumentType object.

The DocumentType object hasnameProperty, which returns the name of the doctype.

If there is no DTD associated with the current document, the doctype property returnsnull.

Syntax:

document.doctype
var doctypeObj = document.doctype;
doctypeObj.name;
Test to see‹/›

Browser Compatibility

All browsers fully support the doctype property:

Property
doctypeYesYesYesYesYes

Technical Details

Return Value:The document's doctype as a DocumentType object
DOM Version:DOM Level1

HTML DOM Document Object