JavaScript Interactivity
Michael Dorman · 2020
This chapter discusses how to link JavaScript code with page contents, to interactively modify the web page. When a web browser loads an Hyper Text Markup Language (HTML) document, it displays (renders) the contents of that document on the screen. The browser remembers the HTML tags, their attributes, and the order in which they appear in the file. This representation of the page is called the document object model (DOM). The DOM is sometimes referred to as an application programming interface for accessing HTML documents with JavaScript. All of the properties and methods of the DOM, available for manipulating web pages, are organized into objects which are accessible through JavaScript code. Two of the most important objects are: the window object and the document object. jQuery is a JavaScript library that simplifies tasks related to interaction with the DOM, such as selecting elements and binding event listeners.