check in javascript if class is in class list code example
Example 1: js check for class in classList
element.classList.contains(className);
Example 2: check if a class exists javascript
<div id="box" class="active"></div>
element.classList.contains(className);
<div id="box" class="active"></div>