触发Bootstrap's不使用按钮或A标记进行折叠

Way to trigger Bootstrap's Collapse without using Buttons or A tags?

本文关键字:折叠 按钮 Bootstrap 触发      更新时间:2023-09-26

当用户单击Radio按钮时,需要触发Bootstrap的Collapse,例如:

<input type="radio" name="radios" value="More" data-toggle="collapse" href="#collapseExample">
<div class="collapse" id="collapseExample">
</div>

但以上这些都不起作用。

我可以把它包装在a标签中,但这会破坏我的风格。

有人知道点击任何元素是否可以触发塌陷吗?

尝试使用.collapse('show');:

$('#trigger').click(function(){
    $('#collapseTwo').collapse('show');
});

请参阅JsFiddle DEMO