👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

How to add class using vanilla js ?

In JavaScript, the simplest way to add a class is to use the method .add() on the property .classList:

var element = document.getElementById('ID');
element.classList.add('myClass');

More