jquery next() outside of div

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-04-19T21:33:11Z Indexed on 2010/04/19 22:43 UTC
Read the original article Hit count: 201

Filed under:
|

Hi,

I'm trying to use next() to toggle a div. The problem is that the "trigger" is in a different div than the one I want to toggle. An example that works:

$("span.trigger").click(function(){
        $(this).next("div.task_description").slideToggle("fast");
});

<span class="trigger">The trigger</span>
<div class="task_description ">
  some content
</div>

But the way I need the html setup is:

<div>
  <span class="trigger">The trigger</span>
</div>
<div class="task_description ">
  some content
</div>

That doesn't work... any suggestions?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript