npm.io
1.0.1 • Published 9 years ago

simple-selectable

Licence
MIT
Version
1.0.1
Deps
1
Vulns
0
Weekly
0

selectable

Simple single-select for html elements - Examples

stable

Install

NPM

Usage

var Selectable =
require('simple-selectable')

var selectable = new Selectable({
    items: document.querySelectorAll('.items'),
    allowActiveDeselect: false                  //Optional, deselect active item if clicked. Defaults to false,
    });

Listen to changes

selectable.on('selectable.change', function(newItem, oldItem){
          //do sth
       })

items containing a 'disabled' class can't be activated

Destroy

selectable.destroy()

License

MIT