jQuery-切换多个元素
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
<!-- jQuery Code --> $(document).ready(function() { $('#commentbox').hide(); $('a.comment').click(function() { var id = $(this).attr('id'); $('#commentbox' + id).toggle(500); // alert(id); return false; }); }); <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>
以上是关于jQuery-切换多个元素的主要内容,如果未能解决你的问题,请参考以下文章
jquery 对象的 heightinnerHeightouterHeight 的区别以及DOM 元素的 clientHeightoffsetHeightscrollHeightoffset(代码片段