Examples

Multiple selectable options

Select elements with multiple selectable options are supported by default. Many plugin parameters can be gleaned from input data attributes which can save you from writing configuration code.


Select element with options in markup.


                
            

                $('.multipleSelect').fastselect();
            

In next example options are loaded from server via ajax request. Note that in this case we are using a normal input element. Url from which options are loaded is communicated via data-url attribute.


                
            

                $('.multipleInputDynamic').fastselect();
            

Options here are loaded dynamicly as well - but initial values for UI are gleaned from item markup (via data-inital-value attribute)


                
            
$('.multipleInputDynamicWithInitialValue').fastselect();

User provided options or tags

User can add his own custom options (tags) by supplying userOptionAllowed parameter as it is shown bellow.


                
            
$('.tagsInput').fastselect();

Single mode select element

Fast select plugin enhances regular select element with UI controls for searching options on the fly. When appropriate options can be loaded via ajax.


Select with options in html as usual




Select with option groups




Input with dynamically loaded options.


                
            

                $('.singleInputDynamic').fastselect();
            



Input with initial value and dynamically loaded options. Upon selection item and item model are logged to console.


                
            

                $('.singleInputDynamicWithInitialValue').fastselect({
                    onItemSelect: function($item, itemModel) {
                        console.log($item, itemModel);
                    }
                });