I've managed to do it. Here is the javascript code: $(document).ready(function() { $('#commentbox').hide();
$('a.comment').click(function() { var id = $(this).attr('id'); $('#commentbox' + id).toggle(500); // alert(id); return false; }); }); And here is the corresponding HTML: <div class="story"> <div class="storytitle">hello</div> <div class="storybg">blah blah blah</div> <div class="storybottom"><a href="#" id="3242" class="comment" name="3242">comment</a></div> <div id="commentbox3242" class="commentbox" style="display:none">comment form</div> </div> The 3242 would be the story ID # and each story has a seperate ID (obviously).