'Vanilla select2 empty data

<div class="custom d-flex" id="myselects">
<select class="step-select rounded-0 select2" id="jsmd" name="md">
<option value="" disabled="true" selected>Search...</option>
</select>
</div> 

<script>
  const element = document.querySelector('.select2');
  const choices = new Choices(element);
</script>

Hi all, I tried the select2 jquery, it works fine. But I wanted to use the select2 vanilla version (choices.js). Problem, I don't get the data the dropdown is empty.

I work with symfony, #jsmd retrieves my data



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source