slidToggle() doesn't work when I use .next()
Hi!
I found a script to hide and show a content using .slideToggle(). I have many element to hide and show. The problem is that all my different contents were showing at the same time. To make sure that just one single content is shown, I tried to use .next(). Unfortunately, it doesn't work. My .toggle_container div still closed.
How can I make it work?
Thanks!
Here is my js :
- $(document).ready(function() {
- $('.toggle_container').hide();
-
- $('a.trigger').click(function() {
- $(this).next('.toggle_container').slideToggle('slow');
- return false;
- });
- });
and that is my html:
- <div class="grid-12">
- <h1><a href="#" class="trigger">link01</a></h1>
- <div class="grid-10 toggle_container">
- text to show or hide01
- </div>
- <h1><a href="#" class="trigger">link02</a></h1>
- <div class="grid-10 toggle_container">
- text to show or hide02
- </div>
- <h1><a href="#" class="trigger">link03</a></h1>
- <div class="grid-10 toggle_container">
- text to show or hide03
- </div>
- </div>