How to add doctype to html page using JavaScript or jQuery

I want to add doctype for my specific page. How to add it using JavaScript or jQuery?

I want to add <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"> using JavaScript .

+4
source share
1 answer

You cannot add DOCTYPE to the current document (or change it).

From MDN-docs : doctype is a read-only property.

+10
source

All Articles