PickMe is customizable html select picker written in pure javascript.
make build
make dev
- http://localhost:8000
HTML
<select name="picker" id="picker">
<option value>Please select</option>
<option value="1" selected>Abbey Storrs</option>
</select>
JS
new PickMe({id: 'picker'})
PickMe registers a global window.PickMe
object that lets you access each initialized select. You can get each instance by using its id:
window.PickMe.elements // or just PickMe.elements
// => {'picker-single': PickMe}
window.PickMe.elements['picker-single']
// => PickMe {..}
Working on this object you can use any method and read any property that PickMe uses, but the only useful methods to call externally are the following:
method | example | description |
---|---|---|
destroy |
PickMe.elements['picker'].destroy() |
Destroys the added dom elements and event handlers. Resets the select to it's state before pick-me was initialized. |
reload |
PickMe.elements['picker'].reload() |
Same as destroy, but re-initializes the element automatically. |
Call a method directly:
window.PickMe.elements['picker-single'].reload()