you'll need an event to attach your function call to, whether that's document ready or click or...
you might also find toggleClass <http://docs.jquery.com/Attributes>to be useful here Jon 2009/9/24 Lleoun <adoming...@vivocom.es> > > Hi all, > > I have the following: > > <div class="unselected" >content</div> > > I want to change unselected into selected when calling a function. > > The ways I'm finding to do a class name change is using a clicking: > $('.unselected').click(function(){ > $('.selected').attr('class','unselected'); > $(this).attr('class','selected'); > }); > > But I don't want to click, I need to do it by calling a function .. > how can I do that? > Thanks a lot ! >