# The “language” attribute on the “script” element is obsolete. Use the “type” attribute instead.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-language-attribute-on-the-script-element-is-obsolete-use-the-type-attribute-instead
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `language` attribute on the `<script>` element has been obsolete since HTML4 and should be removed.

Early versions of HTML used `language="JavaScript"` to specify the scripting language. Modern HTML defaults to JavaScript, so neither `language` nor `type` is required in most cases. The `type` attribute replaced `language` long ago, but even `type="text/javascript"` is unnecessary now because all browsers treat scripts as JavaScript by default.

If you do need to specify a non-JavaScript type (such as `type="module"` or `type="application/json"`), use the `type` attribute. Otherwise, omit both attributes entirely.

## Examples

### Invalid: using the obsolete `language` attribute

```html
<script language="JavaScript">
  console.log("Hello");
</script>
```

### Valid: no attribute needed for plain JavaScript

```html
<script>
  console.log("Hello");
</script>
```

### Valid: using `type` when a specific type is needed

```html
<script type="module">
  import { greet } from "./greet.js";
  greet();
</script>
```
