Using plain JavaScript (not jQuery), Is there any way to check if an element contains a class?
Currently, I\'m doing this:
Tip: Try to remove dependencies of jQuery in your projects as much as you can - VanillaJS.
document.firstElementChild returns tag then the classList attribute returns all classes added to it.
if(document.firstElementChild.classList.contains("your-class")){
// has 'your-class'
} else {
// doesn't have 'your-class'
}