Chapter 11

Understanding the Document Object Model

In This Chapter

arrow Understanding the Document Object Model (DOM)

arrow Interacting with various HTML elements

arrow Using events to your advantage

arrow Changing the page appearance with styles

arrow Creating and using nodes to affect structure

The Document Object Model (DOM) is the means of interaction between JavaScript and HTML5. While HTML5 provides the user interface, JavaScript provides the back-end logic used to make that interface react to user input. The two can’t work well without each other. In fact, many of the examples in this book already rely on the DOM in order to provide basic output. You can’t interact directly with an HTML5 tag, change the structure of a page, or modify the appearance of the content without interacting with the DOM in some way.

The DOM has multiple levels that you’ll encounter in this chapter. The deepest layer is content in the form of text or objects. There are the tags (HTML) that define the interpretation of certain ...

Get HTML5 Programming with JavaScript For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.