Choosable DOM elements. Forked and modified from component/selectable
$ component install gregwym/choosable
<ul id="pets">
<li data-name="tobi">Tobi</li>
<li data-name="loki">Loki</li>
<li data-name="jane">Jane</li>
<li data-name="abby">Abby</li>
</ul>
<script>
var Choosable = require('choosable');
var choosable = Choosable('#pets > li');
choosable.on('change', function(e){
console.log(e.selected.getAttribute('data-name'));
});
</script>
Make elements with the given selector
choosable, with optional context el
.
Add the given el
to the selection.
Remove the given el
from the selection.
MIT