Here is my html code:
<select id="myselect" class="selectpicker" data-live-search="true" placeholder="please type" data-live-Search-Placeholder="search">
<option value="111">AAAAAAAAAAA</option>
<option value="222">bbbbbbbbbbb</option>
<option value="333">cccccccccc</option>
</select>
Here is my javascript code:
$(function(){
var select1 = $('#myselect').selectpicker();
//var mysearchkeyword = $('#myselect').selectpicker('search.initiated').val();
//var mysearchkeyword = $('#myselect').selectpicker('search.input').val();
var mysearchkeyword = $('#myselect').selectpicker('.bs-searchbox').val();
select1.on('changed.bs.select', function (e) {
alert(mysearchkeyword);
});
})
Here is my fiddle: JSFiddle
I want to get the data of searchbox input in bootstrap-select. For example if I type “a” in searchbox I want it to get the “a” as alert message. I read this guide and tried a few ways but it didn’t work. Can you please help me?
Thanks in advance.