The main use of Javascript in the web browser is its ability to create dynamic and interactive webpages. So far, we’ve been looking at HTML and CSS, and you’ve probably noticed that the content is static: the browser will display all the elements that were defined within the HTML file, with the CSS styles applied to them, and nothing else. There is no way for a website’s content to change dynamically (e.g. in response to a user action) by simply using HTML and CSS. We need Javascript for that.

The Document Object Model (DOM)

Adding Javascript to a website

jQuery

Waiting for the DOM to load

Different types of selectors; changing the content of an element (html())

Changing the styling of an element (css() and addClass())

Creating and removing HTML elements (appendTo, remove)