HTML <script> type Attribute
Example
A script with the type attribute specified:
<script type="text/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 |
|---|---|
| scripttype | Specifies the type of the script. Some common values:
Look at IANA Media Types for a complete list of standard media types. |
❮ HTML <script> tag