I want to add and remove a new class(Not toggle) in this span(footer-text)tag By clicking this div(footer-icon)tag. By jQuery or javascript. It needs to be work like siblings cause I have more span tag
For example-
<div class="footer-icon">Hello</div>
<span class="footer-text">Home</span>
Basically, I need to add and remove 2 different classes to different elements with one click. I need to click on this footer-icon class
Html-
<svg version="1.1" class="footer-icon" viewBox="0 0 90 100"
xmlns="http://www.w3.org/2000/svg">
</svg>
<span class="footer-text">Home</span>
css-
.footer-icon-active{
stroke: #fc494d;
}
.footer-active {
color: #fc494d;
}
I have tried but it needs individual clicks
$(".footer-icon").click(function(event){
$(".footer-icon").removeClass('footer-icon-active');
$(this).addClass('footer-icon-active');
});
$(".footer-text").click(function(event){
$(".footer-text").removeClass('footer-active');
$(this).addClass('footer-active');
});
question from:
https://stackoverflow.com/questions/65889615/i-need-to-add-and-remove-2-different-classes-to-different-elements-with-one-clic 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…