Category "jquery-select2"

How do I Listen to Select2 Events in a Stimulus Controller?

I am trying to listen to a Select2 event in a Stimulus controller via the data-action. I have a stimulus controller, where I have included an event listener for

Select2 - use JSON as local data

I can get this to work... var options = [{id: 1, text: 'Adair, Charles'}] $('#names').select2({ data: options, }) But i cant work out how to get from h