without knowing the html, this is rough.
$('a').click(function(){
$('a').removeClass('red')
$(this).addClass('red');
return false;
})
based on your EDIT, the best approach I could suggest is
$('li a').click(function() {
$(this).addClass('red')
.parent()
.siblings()
.children('a')
.removeClass('red');
return false;
});
if your classes are just meant for CSS purpose, I would suggest to add/remove class on li, to minimize codes on javascript part.
$('li a').click(function() {
$(this).parent()
.addClass('red')
.siblings()
.removeClass('red');
return false;
});
then have your CSS
Before
a.red {
color: red;
}
after
li.red a {
color: red;
}