Avatar of Steve
Steve
Flag for Australia asked on

jQuery: Toggle a div that has no ID

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>

Open in new window

Apache Web Server

Avatar of undefined
Last Comment
Steve

8/22/2022 - Mon
Lukasz Chmielewski

ASKER CERTIFIED SOLUTION
Lukasz Chmielewski

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Steve

ASKER
Loved the way a working demo of the solution was given :o)
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck