Answer the question
In order to leave comments, you need to log in
How to remove all classes except one Jquery?
There are three columns. When hovering with the mouse, it is $(this)
highlighted with the help of additional classes, when it mouseleave
returns to its original state.
But one column is already initially highlighted and has additional classes for this in html. The question is how to make it so that when you hover over another column, the one that was originally highlighted becomes inactive again, i.e. he had his classes removed.
Now it turns out that when you hover over other columns, the active one continues to be highlighted no matter what, which is otherwise logical
$(".price__column").on("mouseenter mouseleave", () => {
$(event.currentTarget).toggleClass("price__column_active");
$(event.currentTarget)
.find(".column__period")
.toggleClass("column__period_active");
$(event.currentTarget).find(".button").toggleClass("button_active");
});
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