I am trying to achieve a specific functionality in the code below (click Demo link). How can I remove the "selected" class from the "Zero" li item and then add it to the "Two" li item? Essentially, what I want is to deselect the current li item and select a new one.
In the Demo code, it seems that the removeClass() function affects the newly selected li as well, resulting in none of the li elements having the "selected" class. If you comment out line 11 in the JavaScript code, both "Zero" and "Two" will have the "selected" class. However, the desired outcome is for only "Two" to have the "selected" class.
Any suggestions or recommendations on how to achieve this would be greatly appreciated.