3 We had need of a combobox at work and after looking around at the available options I was not happy with any of them. The project had all it's styling based on Twitter's Bootstrap, so building on that made sense.
7 You can install this plugin one of two ways.
9 #### 1. Manual download
11 Previously, this was the only way to install the plugin. You will need two files included in your HTML in order for this to work:
13 1. js/bootstrap-combobox.js
14 2. css/bootstrap-combobox.css
18 This plugin is now in bower! If you've already installed bower on your machine, simply use the command:
21 bower install bootstrap-combobox
24 This will install the plugin to your bower_components folder. For more information please see http://bower.io/
28 The dependencies are the Bootstrap stylesheet(CSS or LESS). Include it and then the stylesheet(CSS or LESS) and javascript.
30 Then just activate the plugin on a normal select box(suggest having a blank option first):
32 <select class="combobox">
34 <option value="PA">Pennsylvania</option>
35 <option value="CT">Connecticut</option>
36 <option value="NY">New York</option>
37 <option value="MD">Maryland</option>
38 <option value="VA">Virginia</option>
41 <script type="text/javascript">
42 $(document).ready(function(){
43 $('.combobox').combobox();
49 When activating the plugin, you may include an object containing options for the combobox
51 $('.combobox').combobox({bsVersion: '2'});
53 `menu`: Custom markup for the dropdown menu list element.
55 `item`: Custom markup for the dropdown menu list items.
57 `matcher`: Custom function with one `item` argument that compares the item to the input. Defaults to matching on the query being a substring of the item, case insenstive
59 `sorter`: Custom function that sorts a list `items` for display in the dropdown
61 `highlighter`: Custom function for highlighting an `item`. Defaults to bolding the query within a matched item
63 `template`: Custom function that returns markup for the combobox.
65 `bsVersion`: Version of bootstrap being used. This is used by the default `template` function to generate markup correctly. Defaults to '3'. Set to '2' for compatibility with Bootstrap 2
67 `appendId`: The desired id of the transformed combobox. This will become the id attr and can be mapped to a label using the for attribute. Useful for accessibility.
71 Uses the latest 1.X version of jQuery and the latest 2.X or 3.X of bootstrap.
75 ### Bootstrap 2.0 Version
76 http://dl.dropbox.com/u/21368/bootstrap-combobox/index.html
78 ### Bootstrap 3.0 Version
79 http://bootstrap-combobox-test.herokuapp.com/
83 Licensed under the Apache License, Version 2.0