<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".content").hide();
jQuery(".link").click(function()
{
jQuery("div.content").slideToggle(500);
});;
});
</script>
How to expand only the div which is linked to the specific link?
Edit:
Its done like this
<div class="comment">
<div class="bar">
<a class="link">#</a>
</div>
</div>
<div class="content">
<div class="comment">
<div class="bar">
<a class="link">#</a>
</div>
</div>
</div>
EDIT 2:
You changed your HTML. Now do this:
But wait! Now you have 2 different
div.linkelements in different relation to.contentelements. Is this your actual HTML markup?You could also do this:
Please provide your actual HTML.
EDIT:
Based on updated question, do this:
How are they linked?
If the
divis a descendant, do this:If the
divis a an ancestor, do this:If the
divis the next sibling, do this:If the
divis the previous sibling, do this:Without seeing your HTML structure, we can only guess at the solution.