How to add class to a element depending on the class of another item?

For example, if the element with id wow-block-one's got class .this, then element with id list-block-one add class .active
July 8th 19 at 11:52
2 answers
July 8th 19 at 11:54
var list = document.querySelectorAll('[id^="list-block"]');

[]'[id^="wow-block"]'), function(el, i){
 if (el.classList.contains('this')) {
It's cool, thanks. - Uriah commented on July 8th 19 at 11:57
July 8th 19 at 11:56
revove class -> remove class
add class -> add class

Find more questions by tags JavaScript