Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️
https://choices-js.github.io/Choices/
MIT License
6.06k stars 597 forks source link

@fs86 You are assigning the instance to a variable and not doing anything with it. You need to create a closure. #1084

Open charlesrock96 opened 1 year ago

charlesrock96 commented 1 year ago
    @fs86 You are assigning the instance to a variable and not doing anything with it. You need to create a closure. 

Something like:

let choices;

document.addEventListener('DOMContentLoaded', function () {
  choices = new Choices('select');
});

Originally posted by @jshjohnson in https://github.com/Choices-js/Choices/issues/376#issuecomment-453936733

This is the answer, I don't know why they say it doesn't work. Thank you