Chapter 12. The Document Object Model

After completing this chapter, you will be able to

  • Use the Document Object Model (DOM) to retrieve elements from a document.

  • Create new elements in a document.

  • Make changes to elements in a document.

  • Remove elements from a document.

The Document Object Model defined

The Document Object Model (DOM) provides a way to access and alter the contents of Hypertext Markup Language (HTML) documents. The DOM is a standard defined by the World Wide Web Consortium (W3C). Most Internet browsers implement the DOM in various forms—and with varying degrees of success.

Like many other standards, especially those related to web programming, the DOM has evolved over the years. It has three specifications, known as levels in DOM-speak, ...

Get JavaScript Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.