You can know the previously selected/clicked li because it already has
the class name. :) Just remove the class from that li first, then add
it to the newly clicked li:
$('li').click(function() {
$('li.tab-selected').removeClass('tab-selected');
$(this).addClass('tab-selected');
});
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jan 18, 2009, at 8:09 AM, CreativeMind wrote:
hi,
i m adding a class(e.g tab-selected) in li when i click/select or
hover the li, on hover the class is added and removed successfully.
but now when i click any other li, class is added successfully, how
can i remove the class which was added on previously selected li. how
can i know which li was previously selected/clicked and now has lost
the click event.
thx