Answer the question
In order to leave comments, you need to log in
How to remove/add a class from one element and add/remove a class to another?
How to make that when you click on "Set 2" closes "Set 1" and vice versa? That is, so that when you click on "Set 1" from "Set 2" the .opened class is removed and the .closed class appears
Answer the question
In order to leave comments, you need to log in
$('.section').on('click', '.control-label', function() {
$(this)
.closest('.box')
.toggleClass('opened')
.siblings()
.removeClass('opened');
});
.box .list {
display: none;
}
.box.opened .list {
display: block;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question