in an earlier version of select2 I was able to fire an event with select2-selecting when typing into the search box. In 4.0.5, with select2:selecting, it seems to not work anymore. Anyone knowing a working solution? I want to send an ajax request to my sever everytime I type into the searchbar of the select2. Like I said in an earlier version that was possible! Thanks for any advice.
You have to put select2 on a select item in 4.x
https://select2.org/data-sources/ajax
Did it acording to that example and it worked.
I had to change the html element from input to select. Input worked with older versions of select2 but not with 4.x
old html
<input id="groupSelect" name="group_id" type="text" style="max-width: 100%; width: 100%;" required>
new html
<select id="groupSelect" name="group_id" type="text" style="max-width: 100%; width: 100%;" required></select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.