addclass JS Vanilla
element.classList.add('className');
web-noob master
element.classList.add('className');
document.addEventListener("DOMContentLoaded", function() {
var faqContainers = document.getElementsByClassName('faq-container')
var faqToggle = document.getElementsByTagName('body')[0]
for (var i = 0; i < faqContainers.length; i++) {
faqContainers[i].addEventListener('click', function() {
if (faqToggle.classList.contains('faq-display')) {
faqToggle.classList.remove('faq-display')
} else {
faqToggle.classList.add('faq-display')
}
})
}
})