/ Published in: jQuery
URL: http://www.aristoworks.com
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
<!-- 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>
Comments
Subscribe to comments
You need to login to post a comment.

id="3242" is not conform html code ...
Hi,
How can I alter this code, so when it reveals the comment box it hides the link to open the comment box?
e.g. hide: comment
Thanks
Hi,
How do you make it so when you click "Comment" to reveal the comment box, it also actually opens a link as well.
e.g.
< div class="storybottom3242">comment
Hi,
How do you make it so when you click "Comment" to reveal the comment box, it also actually opens a link as well.
e.g.
< div class="storybottom3242">comment