Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove class in all siblings javascript

const setActive = el => {
    [...el.parentElement.children].forEach(sib => sib.classList.remove('active'))
    el.classList.add('active')
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #class #siblings #javascript
ADD COMMENT
Topic
Name
4+7 =