Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dubbs/bootstrap-select-to-button


https://github.com/dubbs/bootstrap-select-to-button

Last synced: 7 days ago
JSON representation

Awesome Lists containing this project

README

        

## Getting Started

This library requires [Bootstrap](http://getbootstrap.com/) and [jQuery](https://jquery.com/), include them as dependencies, then include the bootstrap select source file.

```html

```

### Initialize

The default settings should work for most projects.

```js
$('#select').bootstrapSelectToButton();
```

If you require further customizations you'll have to set options. To see the full list of options, see `$.fn.bootstrapSelectToButton.defaults`.

#### Examples

##### Show search for 5 or more elements

```js
$('#select').bootstrapSelectToButton({
minItemsForSearch: 5
});
```

##### Set button style

```js
$('#select').bootstrapSelectToButton({
classButtonStyle: 'btn-primary'
});
```

## API

This library will listen to change events fired on the original select. To update the bootstrap button group, simply set properties on the original select using [prop](http://api.jquery.com/prop/) and call [change](http://api.jquery.com/change/).

### Disable select

```js
$('#select').prop('disabled', true).change();
```

### Set option selected

```js
$('#select option:eq(3)').prop('selected', true).change();
```