troubleshooting Question

jQuery: Toggle a div that has no ID

Avatar of Steve
SteveFlag for Australia asked on
Apache Web Server
3 Comments1 Solution406 ViewsLast Modified:
I need to toogle divs individually that don't have ID's.

Each time the title section is clicked the content section that follows that title div needs to appear and disappear. At the moment they all appear/disappear.

How do I set it (without using IDs) to only toggle only the content for the section where the title is being clicked?

I can not use a IDs because the HTML is automatically created using a CMS program.

Any help is much appreciated!

The page can be found here...

http://ag-chartered-accountants.com/?action=news


<div id="news"> 

<div class="story">
<div class="title">This is Storey Title 1</div>
<div class="content"> This is the content 1</div>
</div>

<div class="story">
<div class="title">This is Storey Title 2</div>
<div class="content"> This is the content 2</div>
</div>

<div class="story">
<div class="title">This is Storey Title 3</div>
<div class="content"> This is the content 3</div>
</div>

</div>

<script>
  $(".title").live('click', function () {
    $(".content").fadeToggle("fast");
  });
</script>
ASKER CERTIFIED SOLUTION
Lukasz Chmielewski

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros