我使用手风琴在手风琴中显示表单元素,当我单击以查看它显示或隐藏手风琴的下拉列表时,在手风琴标题中有引导dropdownMenuButton
,然后添加了以下代码并能够禁用从按钮冒泡,但是单击按钮时我可以显示下拉菜单项。
我尝试过:
<button onclick="(function(e) {e.preventDefault(); e.stopPropagation(); })(event)" class="btn btn-highlight dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
部分工作,但单击按钮后无法显示下拉菜单。
这是我的代码
<div id="accordion1" class="accordion-list list-group" role="tablist" multiselectable="true">
<div id="tab-1" class="tab list-group-item selected open" aria-selected="true" aria-controls="panel-1"
aria-expanded="true" role="tab" tabindex="0">
<span class="et-temp-icon-institute" aria-hidden="true"></span> @Model.ProductName
(@Model.ProductCode)
<span class="et-temp-icon-caret-right rotate" aria-hidden="false"></span>
<div id="Edit-Product-Action-button" class="dropdown">
<button onclick="$event.stopPropagation();" class="btn btn-highlight dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Actions
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item"href="#">Edit Product</a>
<a class="dropdown-item"href="#">Add Note</a>
<a class="dropdown-item"href="#">View Log</a>
</div>
</div>
</div>
<div id="panel-1" class="panel p-0 m-0" aria-labelledby="tab-1" aria-hidden="false" role="tabpanel" style="">
<div class="row" style="margin-left:15px !important; ">
<div class="quarter">
<h5>accordion content goes here </h5>
</div>
</div>
</div>
</div>
我尝试过:
<button onclick="(function(e) {e.preventDefault(); e.stopPropagation(); })(event)" class="btn btn-highlight dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">