Add JavaScript to your web page - HTML: HyperText Markup Language | MDN (original) (raw)

Take your webpages to the next level by harnessing JavaScript. Learn in this article how to trigger JavaScript right from your HTML documents.

Prerequisites: You need to be familiar with how tocreate a basic HTML document.
Objective: Learn how to trigger JavaScript in your HTML file, and learn the most important best practices for keeping JavaScript accessible.

About JavaScript

JavaScript is a programming language mostly used client-side to make webpages interactive. You can create amazing webpages without JavaScript, but JavaScript opens up a whole new level of possibilities.

**Note:**In this article we're going over the HTML code you need to make JavaScript take effect. If you want to learn JavaScript itself, you can start with our JavaScript basics article. If you already know something about JavaScript or if you have a background with other programming languages, we suggest you jump directly into our JavaScript Guide.

How to trigger JavaScript from HTML

Within a browser, JavaScript doesn't do anything by itself. You run JavaScript from inside your HTML webpages. To call JavaScript code from within HTML, you need the