我使用 jq bootsrtrap 多选,我需要一个必须选择至少一个值的选择。怎么做?
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js"></script>
<select id="select-records" multiple="multiple" class="form-control">
<option value="0">0</option>
<option value="50">50</option>
<option value="500">500</option>
</select>
$('#select-records').multiselect({
maxHeight: 400,
buttonWidth: '100%',
onChange: function (element, checked) {
// ...
}
});
婷婷同学_
相关分类