Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Zoltan Lederer
Zoltan Lederer
10,722 Points

When should I use DOM manipulation in JavaScript? Why is it useful?

I'd like to ask that in what situation is useful to use DOM manipulation? When we add/remove/modify any element (node), these are just temporary. So I don't understand the real purpose of it.

1 Answer

Steven Parker
Steven Parker
229,732 Points

The value of DOM manipulation is in making your pages interactive.

These techniques facilitate animation and responsive interaction to give your users a better experience. And it doesn't have to be temporary. If the dynamic changes are being made to representations of stored data, the final state can be sent back to the server to update the permanent storage.