CSS HTML Validator - The All-In-One HTML, XHTML, CSS, Link, SEO, and Accessibility Checker
Home Help: "script" element

The "script" Element


Use the "script" element to include scripts and data blocks in the document. Use the "src" attribute to specify a script in an external file.

Attributes for "script"
TypeAttribute List
'Standard' Attributes"charset", "defer", "language", "nomodule", "src", and "type"
New HTML5 Attributes"async", "crossorigin", and "integrity"
Obsolete Attributes"event" and "for"

Syntax Notes for "script"

  • The end tag is required.
  • In HTML5+, type="text/javascript" may be left out because it's the default. However, HTML 4.01 requires the "type" attribute and CSS HTML Validator will warn you about this if the "type" attribute is omitted in a pre-HTML5 document.


  • It's generally best to use the "src" attribute to place scripts in external files.

Recommended Links

Search Engine Optimization (SEO)

  • Avoid using client-side scripting to insert tags and content into web pages. Don't use client-side scripting to link to other documents. Search Engines don't run client-side scripting. It's also a bad idea because it should not be assumed that scripting is available (and turned on) in the user's browser.

Search Engine Links (for more information)

Help us improve this page: Suggest a link or noteReport a problem