Get the doctype name of an HTML document:
The result of x will be:
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.
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.
Return Value: | The document's doctype, as a DocumentType object |
---|---|
DOM Version | Core Level 1 Document Object |
HTML reference: HTML <!DOCTYPE> Declaration