这本质上是我在 bootstrap v4 下拉菜单中选择的问题;但是,我需要向它添加一个 select2 标记。重申一下,我想在下拉菜单中放置一个选择框。它可以在台式机上运行,在某种程度上(但不是真的)在移动设备上运行。它张贴在 outtopastureenterprises.com/selectInDropdown.html
顺便说一句,没有 select2,它在移动设备上根本不起作用,这就是我用这个标签重新发布的原因。
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu1">
<span class="dropdown-item" ><input type="text"/></span>
<span class="dropdown-item" >
<!--<span>Grid Size</span>-->
<select class="c-select" style="width: 50%" id="gridSize">
<option>Grid Size</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</span>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
<script>
$(document).ready(function(){
$('select').select2();
});
</script>