Monday

simple way to set tabs to default before highlighting

How many times do you need this? I need it all the time.

Say, you have a set of links (tabs), and onclick you want to highlight one and default the rest.

$('.nav a').click(function(){
$(this).siblings().each(function(){
$(this).removeClass("hi");
});
$(this).addClass("hi");
});





Couldn't be any easier now, could it? Love the each() iterator function. sweet.

No comments: