Understanding the DOM

Document Object Model

by Tania Rascia

DescriptionTable of ContentsDetailsHashtagsReport an issue

Book Description

JavaScript is the de facto programming language of the web, but the language itself does not include any built-in method for working with input/output (I/O), such as graphics display and sound. Instead, the web browser provides an API for accessing the HTML document in a tree structure known as the Document Object Model (DOM). The combination of JavaScript and the DOM is what allows us to create interactive, dynamic websites.

Many modern frameworks, such as React, Vue, and Svelte abstract away much of the DOM from the developer, but frameworks also use the DOM under the hood. The JavaScript library jQuery was also created to make working with the DOM easier, but the modern development practice is to work with the DOM directly. In order to be a proficient web developer, having a deep understanding of what the DOM is and how to work with it is essential. The goal of this book is to provide a base understanding of the DOM, as well as explore examples of the most common and useful methods for interacting with the DOM.

The topics that it covers include:
- The DOM and DOM tree structure;
- How to access, traverse, and modify nodes and elements in the DOM;
- How to modify attributes, classes, and styles in the DOM;
- Use events to make interactive, dynamic websites.

Each chapter is self-contained and can be followed independently of the others. However, if you are not yet familiar with the concept of the DOM and DOM tree, it is recommended that you read the introductory chapters first.

This open book is licensed under a Creative Commons License (CC BY-NC-SA). You can download Understanding the DOM ebook for free in PDF format (3.4 MB).

Table of Contents

Chapter 1
Introduction to the DOM
Chapter 2
Understanding the DOM Tree and Nodes
Chapter 3
How To Access Elements in the DOM
Chapter 4
How To Traverse the DOM
Chapter 5
How To Make Changes to the DOM
Chapter 6
How To Modify Attributes, Classes, and Styles in the DOM
Chapter 7
Understanding Events in JavaScript

Book Details

Computer Science
ISBN13 Digital
ISBN10 Digital
PDF Size
3.4 MB

Related Books

Mathematics Teacher Preparation in Central America and the Caribbean
This open book is an excellent synthesis of the initial and continuing preparation for Mathematics Teaching in Colombia, Costa Rica, Dominican Republic and Venezuela, from which comparative analyses can be made that show similarities and differences, and highlight various perspectives. In August 2012, a workshop of the Capacity and Networking Proj...
This book chronicles the rise of a new scientific paradigm offering novel insights into the age-old enigmas of existence. Over 300 years ago, the human mind discovered the machine code of reality: mathematics. By utilizing abstract thought systems, humans began to decode the workings of the cosmos. From this understanding, the current scientific pa...
The Web as History
he World Wide Web has now been in use for more than 20 years. From early browsers to today's principal source of information, entertainment and much else, the Web is an integral part of our daily lives, to the extent that some people believe 'if it's not online, it doesn't exist.' While this statement is not entirely true, it is becoming increasing...
Rethinking Causality, Complexity and Evidence for the Unique Patient
This open access book is a unique resource for health professionals who are interested in understanding the philosophical foundations of their daily practice. It provides tools for untangling the motivations and rationality behind the way medicine and healthcare is studied, evaluated and practiced. In particular, it illustrates the impact that thin...
Trailblazing in Entrepreneurship
In this book, the authors present a challenge for future research to build a stronger, more complete understanding of entrepreneurial phenomena. They argue that this more complete picture of entrepreneurial phenomena will likely come from scholars who undertake at least some trailblazing projects; from scholars who broaden the range of research que...
International Reflections on the Netherlands Didactics of Mathematics
This book, inspired by the ICME 13 Thematic Afternoon on "European Didactic Traditions", takes readers on a journey with mathematics education researchers, developers and educators in eighteen countries, who reflect on their experiences with Realistic Mathematics Education (RME), the domain-specific instruction theory for mathematics educ...