https://github.com/component/selectable
Selectable DOM elements
https://github.com/component/selectable
Last synced: 8 months ago
JSON representation
Selectable DOM elements
- Host: GitHub
- URL: https://github.com/component/selectable
- Owner: component
- Created: 2013-05-07T03:31:14.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-05-13T15:52:42.000Z (almost 13 years ago)
- Last Synced: 2025-04-03T07:05:48.449Z (12 months ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 26
- Watchers: 7
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# selectable
Selectable DOM elements.

## Installation
$ component install component/selectable
## Example
```html
- Tobi
- Loki
- Jane
- Abby
var selectable = require('selectable');
var selection = selectable('#pets > li');
selection.on('change', function(e){
for (var i = 0; i < e.selected.length; i++) {
console.log(e.selected[i].getAttribute('data-name'));
}
});
```
## API
### Selectable(selector, el)
Make elements with the given `selector` selectable, with optional context `el`.
### Selectable#select(els)
Add the given `els` to the selection.
### Selectable#deselect(els)
Remove the given `els` from the selection.
## License
MIT