Skip to content

jQuery dropdownlist disabled

Maikel Bos edited this page Dec 28, 2020 · 4 revisions

When creating a dropdownlist, sometimes you want it to be disabled until some other input occurs. To achieve this, set the data-disabled attribute to 'true'. To enable the dropdownlist afterwards, see manipulating the dropdownlist after creating.

<div id="example-dropdown" data-disabled="true">
    <div data-select-all="true">Select all options</div>
    <div>Choice number 1</div>
    <div>Option 1a</div>
    <div>Second choice</div>
    <div>Final option</div>
</div>

<script type="text/javascript">
    $('#example-dropdown').dropdownlist();
</script>
Clone this wiki locally