Answer the question
In order to leave comments, you need to log in
How to remove a class from a block in js by clicking on the same block?
How to remove a class from a block by clicking on the same block next to it and add it to the one that was clicked last, on pure js, jquery is full of examples, I will be grateful
let blockClick = document.querySelectorAll('.item-layout')
for (var i = 0; i < blockClick.length; i++) {
blockClick[i].addEventListener('click', function(e) {
this.classList.add('active-bg');
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question