The script element is used to define a client side script code with the most common being the JavaScript.

The <script> tag in the document's head section is used to add script into HTML internally or by linking it to an external source.

Client side scripts are mostly used to increase and speed up site's interactivity with the users and to add dynamics to it. That is possible thanks to the fact that browsers cache the code once loaded and evoke it as necessary.

The <script> element is often used in the head section, but can be inserted in the body or even after the body element.

The noscript element is used to provide alternative content when JavaScript is not available and it is placed inside the body element.

Syntax:

<script type="text/javascript" /></script><noscript></noscript>

Attributes:

Example

HTML script element:

 

›› go to examples ››