I've currently got a list where each list element fades in a
corresponding div when clicked. It's set to toggle so that it will
fade out the same div when clicked again. I've set it up to also hide
all divs so that they don't overlap each other.

my code is below...my question is, is there a more efficient way to
achieve the same thing?

$('a.question1').toggle(function(){
                        $('div.answer1, div.answer2, div.answer3, div.answer4, 
div.answer5,
div.answer6').fadeOut();
                        var answers = $('div.answer1');
                        answers.fadeIn();
                }, function(){
                        $('div.answer1, div.answer2, div.answer3, div.answer4, 
div.answer5,
div.answer6').fadeOut();
                        var answers = $('div.answer1');
                        answers.fadeIn();
});

Reply via email to