Chapter 3: The Basics of DOM Manipulation in Vanilla JavaScript (No jQuery)
by Sebastian Seitz
Peer reviewed by Vildan Softic and Joan Yin.
Whenever we need to perform DOM manipulation, we're all quick to reach for jQuery. However, the vanilla JavaScrpt DOM API is actually quite capable in its own right, and since IE < 11 has been officially abandoned, it can now be used without any worries.
In this article, I'll demonstrate how to accomplish some of the most common DOM manipulation tasks with plain JavaScript, namely:
- querying and modifying the DOM,
- modifying classes and attributes,
- listening to events, and
- animation.
I'll finish off by showing you how to create your own super slim DOM-library that you can drop into any project. Along the ...
Get Modern JavaScript 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.