Javascript .classList API Cheatsheet

Razet · · 1352 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

Please login or create new account to add your comment.

0 comments
You may also like: