O'Reilly logo

JavaScript: Novice to Ninja, 2nd Edition by Darren Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6: The Document Object Model

The Document Object Model (DOM) allows you to access elements of a web page and enable interaction with the page by adding and removing elements, changing the order, content and attributes of elements, and even altering how they are styled.

In this chapter, we’ll cover the following topics:

  • Introduction to the DOM

  • Getting elements ―getElementById, getElementsByClassName, getElementsByTagName, querySelector and querySelectorAll

  • Navigating the DOM

  • Getting and setting an element’s attributes

  • Updating the DOM by creating dynamic markup

  • Changing the CSS of an element

  • Our project ― we'll dynamically insert each question into the HTML

The Document Object Model

What is the DOM?

The Document Object Model, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required