hasclass property javascript code example
Example 1: javascript hasclass
if (document.body.classList.contains('thatClass')) {
// do some stuff
}
Example 2: how to check has class name in js?
element.classList.contains(className);Code language: CSS (css)