Tiny (~2KB) jQuery-based select field replacement used at Feedient.
- jQuery OR Zepto.js
- FontAwesome for up/down chevrons.
HTML
<a class="select" id="select-language">
<div class="option selected" data-value="en-GB">English (UK)</div>
<div class="option" data-value="en-US">English (US)</div>
<div class="option" data-value="nl-BE">Nederlands</div>
<div class="option" data-value="sv-SE">Svenska</div>
</a>
Initialize selectField
$('#select-language').selectField();
Listen for changes
$('#select-language').on('change', function(e, value) {
// Do something with value
});
Get value
var value = $('#select-language').attr('data-value');