Javascript .classList API Cheatsheet
Razet · · 3560 Views
Let's say you have an element in the DOM:
<div id="el"></div>
Now get a reference to that DOM element using querySelector
:
const el = document.querySelector("#el");
Now, you can manipulate the classes on that element with the classList
method.
0
You may also like:
Please login or create new account to add your comment.