[jQuery] class change problem
I'm new to jquery so be kind:
My problem is this;
I am trying to change the class of some links so that when I click on
one it becomes class "sel" (a particular background image), then when
I click on the next one, it becomes class "sel" and the previous one
returns to its before click state.
According to the jquery site docs toggleClass should do it, but what I
get is all clicked links become class "sel" and none return to their
pre-clicked state:
toggleClass( class ) Returns: jQuery
Adds the specified class if it is not present, removes the specified
class if it is present.
Here's my code:
$(document).ready(function()
{
$(".accordion a").click(function(){
$(this).toggleClass("sel");
});
});
What am I doing wrong?
Thanks,
Bob