答案 0 :(得分:3)
可能是其他原因阻止了您进入空间,bootstrap-select并不能阻止您进入空间,请查看以下演示:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.0/css/bootstrap-select.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.0/js/bootstrap-select.min.js"></script>
<select class="selectpicker" data-live-search="true">
<option>Hot Dog, Fries and a Soda</option>
<option>Burger, Shake and a Smile</option>
<option>Sugar, Spice and all things nice</option>
</select>
答案 1 :(得分:0)
//CAN ENTER SPACES
$(function() {
$('.selectpicker').selectpicker({
liveSearch: false,
showSubtext: true
});
});
//CANNOT ENTER SPACES
$(document).ready(function() {
$('.selectpicker').selectpicker({
liveSearch: false,
showSubtext: true
});
});