Hello I have issue with my jquery code, because when I want to press any key to get query from database that is not working (it is not showing any alert). I think my ajax isn’t working very well because I tried to copy other code and didn’t work. I want to get data from database with my skills to choose in options
jQuery code
$(document).ready(function () {
$("#skills").click(function () {
alert("test")
});
});
<select class="select2bs4" multiple="multiple" name="ums[]" data-placeholder="Skills"
style="width: 100%;" id="skills">
</select>
And I want to do when I press any key then should show any result in multiple select but at beginning didn’t show any alert yet.
I tried to do like “Select2 and Laravel: Ajax Autocomplete” from Laraget website and that wasn’t working too
EDIT____
If it’s only input with type ‘text’ it’s working fine to show alert
Thank you in advance
2
Answers
Select will not work with click but with change , but if you want change when you write in select like search bar , replace this :
to this if you want to get the change option :
or this if you want to handle user input :
Try this