I'm having trouble with a content switcher and I think my issue is
understanding how to targeting  utilizing 'this'

Here's my HTML and script:

[code]
<div id="mainArticle">
        <div id="latestArticle" class="article">
                <h1><span>tab 1</span></h1>
                <div class="teaser">content</div>
        </div>
        <div id="inTheMag" class="article">
                <h1><span>tab 1</span></h1>
                <div class="teaser">content</div>
        </div>
</div>

$(document).ready(function() {
        $('#mainArticle .latestArticle .teaser').hide();
        $('#mainArticle .latestArticle h1 span').addClass("hidden");
        $('#mainArticle > div').each(function(){
                $('h1 span',this).click(function(){
                        $('#mainArticle h1 span').addClass("hidden");
                        $('h1 span',this).removeClass("hidden");
                        $('#mainArticle .teaser').hide();
                        $('.teaser',this).slideDown('slow');
                });
        });
});
[/code]

I also want to make which div displays random, so any help on that
would be great too.

Reply via email to