Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add doctype in html page using JavaScript or jQuery

I want to add a doctype for my particular page. How can I 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.

like image 631
Sagar Avatar asked Aug 23 '11 09:08

Sagar


1 Answers

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

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

like image 124
Dr.Molle Avatar answered Oct 17 '22 00:10

Dr.Molle