/ Published in: jQuery

I used this simple snippet to enable users to "View More Info" which was embedded in a div below each of a list of items. This is different from many of the simple jQuery examples that only allow you to show/hide one particular div.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- jQuery Code --> $(document).ready(function() { $('#commentbox').hide(); $('a.comment').click(function() { var id = $(this).attr('id'); $('#commentbox' + id).toggle(500); // alert(id); return false; }); }); <!-- 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>
URL: http://www.aristoworks.com
Comments
