The HTML type Attribute's Values for JavaScript

By: Dusty Arlia
Published on February 17, 2013
Last Updated on Thursday, July 16, 2015 at 7:35 PM
Total Updates: 2

JavaScript can have different type values for the HTML type attribute. Here are some examples:

  • type="text/javascript" (most compatible)
  • type="text/ecmascript"
  • type="application/ javascript" (newer)
  • type="application/ecmascript" (newer)
  • or no type attribute at all

Be prepared to see these variations of the type attribute and to possibly see the language attribute in its place. You will most likely see and use the type attribute's text/javascript value, because this is the value that is most widely supported across all the major browsers (<script> elements have a default type attribute value of text/javascript and is no longer needed).