Leaving a class in place

Hi, I have a page with several lists with 4 thumbnails and 1 main image each. The images are being swapped using a modified version of this.

$(document).ready(function(){
	$(".brand-details li a").click(function(){
			var largePath = $(this).attr("href");
			var largeAlt = $(this).attr("title");
			$('.brand-details li').removeClass('current');
			$(this).parent('li').addClass('current');
			$(this).parent('li').parent('ol').children('.largeImg').children('img').attr({ src: largePath, alt: largeAlt });return false;	
	});
});

As you can see, a class is removed/added to highlight the current image but when you click on a thumbnail on a separate list it also removes the class from the previous list.

How can I get it to leave the class IF it is a different list. Preferably without needing an ID?

Many thanks

Try the following, if your using an ordered list simply change ul to ol.

$(this).parents('ul').children('li').removeClass('current');

Where would I put that? Would I replace the existing add/remove class code?

You would simply replace

$(‘.brand-details li’).removeClassCOLOR=#66cc66[/COLOR];

That’s done it, thanks so much!

No problem