Bootstrap selectpicker 选中项格式
Bootstrap selectpicker selected items format
我有多个选择器,但我不明白如何更改所选项目的格式。大家有什么建议吗?
我阅读了 this 并找到了选项 selectedTextFormat 但这不是我需要的
$('.selectpicker').selectpicker({
selectedTextFormat: 'values'
});
找到解决方案
$(window).on('load', function() {
$('.selectpicker').selectpicker({
showSubtext: true
});
});
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.min.js"></script>
<select class="selectpicker form-control" multiple>
<option data-subtext="Mustard" value="">1</option>
<option data-subtext="Ketchup">2</option>
<option data-subtext="Relish">3</option>
</select>
我有多个选择器,但我不明白如何更改所选项目的格式。大家有什么建议吗?
我阅读了 this 并找到了选项 selectedTextFormat 但这不是我需要的
$('.selectpicker').selectpicker({
selectedTextFormat: 'values'
});
找到解决方案
$(window).on('load', function() {
$('.selectpicker').selectpicker({
showSubtext: true
});
});
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.min.js"></script>
<select class="selectpicker form-control" multiple>
<option data-subtext="Mustard" value="">1</option>
<option data-subtext="Ketchup">2</option>
<option data-subtext="Relish">3</option>
</select>