1. Select 2
Browser compatibility
- IE 8+
- Chrome 8+
- Firefox 10+
- Safari 3+
- Opera 10.6+
<script>
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
</script>
<select class="js-example-basic-single">
<option value="AL">Alabama</option>
...
<option value="WY">Wyoming</option>
</select>
更多实例参考:https://select2.github.io/examples.html
2. bootstrap-select
<script>
$(function(){
// To style only <select>s with the selectpicker class
$('.selectpicker').selectpicker();
//Or
// To style all <select>s
$('select').selectpicker();
})
</script>
<select class="selectpicker" data-live-search="true">
<option data-tokens="ketchup mustard">Hot Dog, Fries and a Soda</option>
<option data-tokens="mustard">Burger, Shake and a Smile</option>
<option data-tokens="frosting">Sugar, Spice and all things nice</option>
</select>
更多实例参考:https://silviomoreto.github.io/bootstrap-select/examples/
原文/转自:Bootstrap 3 下拉选框 select boxes