I plan on using jQuery to show/hide comment boxes for corresponding news stories on my website. I have implemented the code to make just the one box slidetoggle, but like I mentioned there are numerous comment boxes on the page and I don't really know how to make them all behave independently.
I've had a look at some accordion type tutorials, but from what i've seen they all focus on using a similar HTML structure, which wouldn't be feasible to use with my news layout. I hope that someone can help with this, I have searched endlessly but my searches have yielded no helpful results. Here is the layout of one of the stories on the page, this is repeated many times for each story: <div class="story"> <div class="storytitle">hello</div> <div class="storybg">main story article</div> <div class="storybottom"><a href="#" id="comment- toggle">add comment</a></div> <div class="commentbox" style="display:none;">comment form here</div> </div> And the javascript: $(document).ready(function() { $('.commentbox').hide(); $('a#comment-toggle').click(function() { $('#commentbox').slideToggle("slow"); alert($('#commentbox')); return false; }); });