Tutorials References Menu

HTML <script> type Attribute

❮ HTML <script> tag

Example

A script with the type attribute specified:

<script type="application/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
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

Attribute
type Yes Yes Yes Yes Yes

Syntax

<script type="scripttype">

Attribute Values

Value Description
media_type 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