HTML <script> tag
When writing in HTML, the <script> tag is and inline element used to designate a client-side script on a web page. The <script> tag either points to an external script file or contains scripting statements. It is useful for adding things like dynamic content or form validation. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <script> tag, as well as a description of each.
Usage note: The type attribute is optional in HTML5, but still required in HTML 4.
|async||Designates that the script should be executed asynchronously (external scripts only)|
|charset||Designates the character encoding used with an external script file|
|defer||Designates that the script is executed once the page has finished parsing (external scripts only)|
|src||Designates the URL of an external script file|
|type||Designates the script's media type|
A deprecated attribute is one that may function currently but is not supported in going forward. While the attribute may work with the current version of HTML, it will eventually be phased out. It is better to avoid using these attributes to help future-proof your website.
|xml:space||Designates whether or not whitespace in code should be preserved|
|All versions||All versions||All version||All versions||All versions|