O'Reilly logo

Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition by Phil Ballard, Michael Moncur

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

Hour 12. Scripting the DOM

What You’ll Learn in This Hour

• How to create new elements

• Ways to add, edit, and remove child nodes

• Dynamically loading JavaScript files

• Changing element attributes

Tip

When you amend the DOM using the methods described in this hour, you change the way a page appears in the browser. Bear in mind, though, that you’re not changing the document itself. If you ask your browser to display the source code of the page, you won’t see any changes there.

That’s because the browser is actually displaying the current DOM representation of the document. Change that, and you change what appears onscreen.

In the previous hour, you learned how to navigate the DOM tree to select specific nodes (or collections of nodes) and ...

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