javascript hass class
snippet in javascript

javascript hass class

user5638

if (myElement.classList.contains('someClassname')) {
    // do something
}

query selector has clas

user5048

document.body.classList.add('thisClass');
// $('body').addClass('thisClass');

document.body.classList.remove('thatClass');
// $('body').removeClass('thatClass');

document.body.classList.toggle('anotherClass');
// $('body').toggleClass('anotherClass');