The <script> element

Contains or links to JavaScript code to add dynamic or interactive features to the document. Very occasionally the code might be in a different programming language such as VBScript, but JavaScript is much more widely supported.

Full list of attributes

All the usual HTML global attributes are available

async
If present, the code should be executed asynchronously as soon as the file has been loaded by the browser. Only allowed if src attribute is present.
charset
Used with the src attribute. Specifies the character encoding of the file containing the code.
crossorigin
A CORS settings attribute for script files from third party sites.
defer
If present, then the code will not be executed right away. Instead, the browser will queue it up for execution after the whole HTML page has been loaded and parsed. Only allowed if src attribute is present.
src
The URI of the file containing the code. If this attribute isn't present then the code is the content of the <script> element.
type
The MIME type of the scripting language the code is written in. Defaults to text/javascript, so you don't need to use this if the code is in JavaScript.

Further information

The Web Design Academy Contact us

By form

By Phone

+44 (0)113 234 4611

By email

enquiries@thewebdesign.academy

By snail mail

Suite 3 15 South Parade Leeds LS1 5PQ United Kingdom