jQuery dropdownlist initialize selected items - maikelbos0/VDT GitHub Wiki

It is possible to set the initially selected value(s) using the data-selected attribute. When creating single-select dropdownlists, it will select the first child element where the attribute is present and is not set to false. For multiselect dropdownlists, it will select all child elements where the attribute is present and is not set to false.

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

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