stylepile
11-20-2009, 03:37 PM
I am using the script below to show and hide three divs using three links. What I would like to know is how to add a class to the currently clicked link and then remove it when one of the other links is clicked.
$(document).ready(function(){
var divs = $('div.recommended_block, div.buying_advice_block, div.brand_reviews_block').hide();
$('div.recommended_block').show();
$('a#recommended_block, a#buying_advice_block, a#brand_reviews_block').click(function() {
divs.filter(':visible').hide();
$('.' + this.id).show();
return false;
});
});
$(document).ready(function(){
var divs = $('div.recommended_block, div.buying_advice_block, div.brand_reviews_block').hide();
$('div.recommended_block').show();
$('a#recommended_block, a#buying_advice_block, a#brand_reviews_block').click(function() {
divs.filter(':visible').hide();
$('.' + this.id).show();
return false;
});
});