What should be used and why should it be used?
Alternatively, you might skip either of them, as seen in the example code in the jQuery API reference:
Asked by Ricket
For a long time, the language attribute has been deprecated, and it should no longer be utilised.
Omitting type in XHTML 1.0 or HTML 4.01 is considered incorrect. Attempt to validate the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script src="http://example.com/test.js"></script> </head> <body/> </html>
The following error will be displayed to you:
So, if you like standards, go ahead and use it. It should have no practical effect, but if in question, go with the specification.
Answered by Matchu
HTML5 addresses the fact that there is only one scripting language on the internet and allows users to create their own.
The latter is compatible with any browser (NN2+) that supports scripting.
Answered by Ms2ger
Within an HTML document, the type attribute is used to specify the MIME type. The type value may be necessary to validate the HTML document, depending on the DOCTYPE you select.
Answered by JasCav
Post is based on https://stackoverflow.com/questions/2267476/html-script-tag-type-or-language-or-omit-both