O'Reilly logo

DOM Scripting: Web Design with JavaScript and the Document Object Model, Second Edition by Jeffrey Sambells, Jeremy Keith

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 3. The Document Object Model

What this chapter covers:

  • The concept of nodes

  • Five very handy DOM methods: getElementById, getElementsByTagName, getElementsByClassName, getAttribute, and setAttribute

It's time to meet the DOM. This chapter introduces you to the DOM and shows you the world through its eyes.

D is for document

The DOM can't work without a document. When you create a web page and load it in a web browser, the DOM comes to life. It takes the document that you have written and turns it into an object.

In normal everyday English, the word object isn't very descriptive. It simply means thing. In programming languages, on the other hand, object has a very specific meaning.

Objects of desire

At the end of the previous chapter, you saw some ...

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