how to find whether class exists in element in javascript 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>