jQuery dropdownlist working with values - maikelbos0/VDT GitHub Wiki

By default, jQuery-dropdownlist creates input fields that have values that correspond to the text of the child items. To set an explicit value for the field corresponding to each item, you can use the data-value attribute on the child elements. For child elements that don't have this attribute the plugin will still fall back to the text.

<div id="example-dropdown">
    <div data-value="1">Choice number 1</div>
    <div data-value="1a">Option 1a</div>
    <div data-value="3">Second choice</div>
    <div>Final option</div>
</div>

<script type="text/javascript">
    $('#example-dropdown').dropdownlist();
</script>
⚠️ **GitHub.com Fallback** ⚠️