Tutorials References Exercises Bootcamps Videos Menu
Sign Up Create Website Get Certified Upgrade

HTML <script> type Attribute

❮ HTML <script> tag


A script with the type attribute specified:

<script type="application/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
Try it Yourself »

Definition and Usage

The type attribute specifies the type of the script.

The type attribute identifies the content between the <script> and </script> tags.

Browser Support

type Yes Yes Yes Yes Yes


<script type="scripttype">

Attribute Values

Value Description
scripttype Specifies the type of the script.

Some common values:
  • A JavaScript MIME type like: application/javascript (default) or application/ecmascript
  • module:
  • Another MIME type. src attribute will be ignored

Look at IANA Media Types for a complete list of standard media types.

❮ HTML <script> tag