mardi 24 mars 2015

Jquery show/hide div on dynamic content


I have a loop which outputs the following content...



<div class="item-title"><a href="">Title here</a></div>
<div class="item-content">
<div class="item-body">
Body Here
</div>
</div>
</div>


I want to HIDE .item-content on page load.


When you click the title, it should SHOW .item-content


When you click the title again, it should HIDE .item-content


The problem is that as my query loops through, it assigns EVERY article a class of .item-content so EVERY article opens and closes together.


How do I make it show each title ONLY opens the corresponding content and not every piece of article content?





Aucun commentaire:

Enregistrer un commentaire