brianvoe/slim-select

`getInstance`

Closed this issue · 1 comments

Is there an easy way for me to get an instance of SlimSelect that's already initialized?

For example, I'd like to adjust some available data options plus enable a select after it's already been initialized by other code:

// some page specific script
let ss = SlimSelect.getInstance("#select-id")

// replace all options
ss.options.data = [
  {text: 'Value 1'},
  {text: 'Value 2'},
  {text: 'Value 3'}
]

// or add additional options
ss.options.data << [{text: "New Option 1"}, {text: "New Option 2"}]