I can't build the whole thing for you because I don't know what is being clicked and which element's class you want changed, but in general you can manipulate classes with .addClass('some-class') and .removeClass('optional-class-name') and .toggleClass('some-class').

You'll find these methods (and more!) here:
http://docs.jquery.com/Attributes/

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jan 25, 2008, at 12:23 PM, vanoosterhout wrote:


I know this may be a pretty elementary question, but I am trying to
figure out how to change a class based on a click.  I think should be
able to do this with replaceWith, but for some reason I am struggling.

I have this:

<li id="st1" class="current">1.Boat Select</li>
<li id="st2" class="">2.Halyard Length</li>
<li id="st3">3.Shackle Select</li>

and for example would like to change it to:

<li id="st1" class="done">1.Boat Select</li>
<li id="st2" class="current">2.Halyard Length</li>
<li id="st3">3.Shackle Select</li>


Basically I want to be able to change the class ... and nothing else.
If anyone could provide a snippet of sample code I would be very
thankful.

Thanks,

Christopher

Reply via email to