on click, add class to alternative div with jQuery
I have two divs,
div2. On clicking any of these div, I want to remove class
.active from it and add that class to the other div.
I’m trying following code, but I cant figure out how to add the class to the other div which is not clicked. Thanks.
Since there are only two elements, you could just use
Similarly, it’s worth pointing out that you could also negate one of the elements using