X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM doctype Property

Document Object Reference Document Object

Example

Get the doctype name of an HTML document:

var x = document.doctype.name;

The result of x will be:

html

Try it yourself »


Definition and Usage

The doctype property returns the doctype of the HTML document, as a DocumentType object.

The DocumentType object has a name property, which returns the name of the doctype.

Note: If the document has no doctype specified, the return value is null.


Browser Support

Property
doctype Yes Yes Yes Yes Yes

Note: In Internet Explorer 8 and earlier, this property returns null for HTML and XHTML documents, and will only work for XML documents.


Syntax

document.doctype

Technical Details

Return Value: The document's doctype, as a DocumentType object
DOM Version Core Level 1 Document Object


Related Pages

HTML reference: HTML <!DOCTYPE> Declaration


Document Object Reference Document Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook