I am using SELECT2 for the first time and have made my way through the documentation.
In my header of the HTML I have:
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
In the body I have:
<select class="js-example-basic-multiple" name="states[]" multiple="multiple">
<option value="AL">Alabama</option>
...
<option value="WY">Wyoming</option>
</select>
And the external js file I have:
$(document).ready(function() {
$('.js-example-basic-multiple').select2({
placeholder: 'Select an option',
allowClear: true,
selectionAdapter: MultipleSelection,
theme: "classic",
tokenSeparators: [,],
scrollAfterSelect: true,
tags: true
});
})
Currently I’m just seeing the multi-select box but it is not being displayed as a dropdown with the pills showing on selection.