25. Finding Elements in the DOM

In This Chapter

  • Learn how to find elements in the DOM

  • Use the CSS selector syntax for cleverer element discovery

As we saw in the previous chapter, our DOM is nothing more than a tree-like structure (see Figure 25.1) made up of all the elements that exist in our HTML document.

Image

FIGURE 25.1

Yep. Looks like a tree-like structure all right!

That detail is only sort of important. What is important is that you have all of these HTML elements floating around that you want to access and read data from or modify. There are many ways to find these HTML elements. After all, these elements are arranged in a tree-like ...

Get JavaScript Absolute Beginner's Guide, 2nd Edition 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.