Javascript bootstrap中的折叠元素 评论 加 提交
这就是我的代码。我有一个bootstrap中的collapsable元素,我正试图让它在页面中开始折叠,但尝试了多种不同的方法,我做不到。我使用了两个jQuery命令,如hide()和collapse,但它们似乎都不起作用。关于如何实现这一点有什么想法吗?只需从Javascript bootstrap中的折叠元素 评论 加 提交,javascript,jquery,css,twitter-bootstrap,Javascript,Jquery,Css,Twitter Bootstrap,这就是我的代码。我有一个bootstrap中的collapsable元素,我正试图让它在页面中开始折叠,但尝试了多种不同的方法,我做不到。我使用了两个jQuery命令,如hide()和collapse,但它们似乎都不起作用。关于如何实现这一点有什么想法吗?只需从id='comments'div中删除中的,正如我在这个JSFiddle中所显示的那样,就可以在单击add按钮时显示comments文本区域: 摆脱div[id=“comments”]元素的类中的。项目中是否包含bootstrapjs文件
id='comments'
div中删除中的,正如我在这个JSFiddle中所显示的那样,就可以在单击add
按钮时显示comments文本区域:
摆脱div[id=“comments”]
元素的类中的。
项目中是否包含bootstrapjs文件似乎在这里工作@ArunPJohny不,似乎在那里不工作。但是,如果您在
类中删除了,则会删除。是否希望默认情况下将其折叠?然后您需要删除
类中的
<div >
<div>
<h3 style="display:inline-block;">Comments</h3>
<button id="add_button" style="display:inline-block;margin-left:240px;" type="button" class="btn btn-primary" onClick="$('#add_button').hide()" data-toggle="collapse" data-target="#comments">Add</button>
</div>
<div id="comments" class="collapse in">
<textarea style="resize:none;width:90%;" class="input xlarge" rows="4" id="comment-box" name="comment-box" placeholder="Type your comment here..."></textarea>
<button style="margin-right:30px;" id="submit_comment" class="btn btn-primary pull-right" name="submit_comment" type="submit" onClick="">Submit</button>
</div>
</div>