CHAPTER 7

image

Manipulating the DOM

In the previous chapter, I showed you how to select elements. One of the most powerful things you can do with the selection is to change the structure of the HTML document itself, known as manipulating the DOM. In this chapter, I’ll show you the different ways in which you can alter the structure, including inserting elements as children, parents, or siblings of other elements. I’ll also show you how to create new elements, how to move elements from one part of the document to another, and how to remove elements entirely. Table 7-1 provides the summary for this chapter.

Table 7-1. Chapter Summary

Problem Solution ...

Get Pro jQuery 2.0, Second Edition now with O’Reilly online learning.

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