Skip to content

justinchmura/jquery.bootstrap-chooser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Bootstrap Token Chooser

jQuery Bootstrap Token Chooser

Dependencies

Currently, this plugin is built on top of jQuery 1.11/2 and uses Twitter Bootstrap 3.

Example Usage

HTML

<div id="chooser"></div>

jQuery

Use the plugin as follows:

$('#chooser').chooser({
    data: ['option 1', 'option 2', 'option 3']
});

Options

Name Type Required? Default Description
placeholder string optional 'Choose...' Placeholder text to show in the input
labelClass string optional 'info' Bootstrap label CSS class to apply to the tokens inside the input
data array required [] Array of string tokens to be the options
max number optional null Maximum number of selections allowed
select function optional null Callback invoked after a selection is made

Methods

Name Args Returns Description
$().chooser('destroy') none undefined Destroys the plugin. Removes all references.
$().chooser('selections') none array of selected strings Get the current list of selected tokens
$().chooser('update', []) array of strings undefined Update the data list with a new list. Does clear the selected tokens.

CSS

All the CSS that is needed is provided in the stylesheet. Copy to wherever you need it.

Installation

Reference the script file and the CSS stylesheet. Requires jQuery and Bootstrap. Bower installation coming soon.

TODO

  • Add meaningful tests
  • Create Bower package

License

This plugin is available under the MIT license.

About

A multiple token selector using Bootstrap styling.

Resources

License

Stars

Watchers

Forks

Packages

No packages published