Looking for a way to seamlessly switch between two links with different CSS classes each time a user clicks? Here's what's currently happening:
<a class="class1" id="class1">Class1</a>
<a class="class2" id="class2">Class2</a>
As it stands, the code only works once. Subsequent clicks do not produce the desired result:
$("#class1").click(function(){
$("#class1").removeClass().addClass("class2");
$("#class2").removeClass().addClass("class1");
})
$("#class2").click(function(){
$("#class1").removeClass().addClass("class2");
$("#class2").removeClass().addClass("class1");
})
The objective is to alter the color through CSS.