"Button Dropdown Select"
Bootstrap 3.0.1 Snippet by comandor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<select class="selectpicker" data-style="btn-primary" style="display: none;">
<option data-icon="glyphicon glyphicon-music">Mustard</option>
<option data-icon="glyphicon glyphicon-star">Ketchup</option>
<option data-icon="glyphicon glyphicon-heart">Relish</option>
</select>
<select class="selectpicker" data-style="btn-primary" data-width="auto" style="display: none;">
<option data-icon="glyphicon glyphicon-music">Mustard</option>
<option data-icon="glyphicon glyphicon-star">Ketchup</option>
<option data-icon="glyphicon glyphicon-heart">Relish</option>
</select><br>
<script type="text/javascript">
window.onload=function(){
$('.selectpicker').selectpicker();
$('.rm-mustard').click(function() {
$('.remove-example').find('[value=Mustard]').remove();
$('.remove-example').selectpicker('refresh');
});
$('.rm-ketchup').click(function() {
$('.remove-example').find('[value=Ketchup]').remove();
$('.remove-example').selectpicker('refresh');
});
$('.rm-relish').click(function() {
$('.remove-example').find('[value=Relish]').remove();
$('.remove-example').selectpicker('refresh');
});
$('.ex-disable').click(function() {
$('.disable-example').prop('disabled',true);
$('.disable-example').selectpicker('refresh');
});
$('.ex-enable').click(function() {
$('.disable-example').prop('disabled',false);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
@import url("http://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.min.css")
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: