0

i have a bit problem with a select search of bootstrap, i need get the value of the search.

 <div class="form-group has-feedback has-feedback-left">
        <select class="form-control bootstrap-select" data-live-search="true" asp-for="Client" asp-items=@ViewBag.clients></select>
 </div>

i'm trying to get into a change event, but only can get the id and the value of the option, but not of the search value...

$("#Client").change(function () {
     alert(this.value);
});
Sascha
  • 4,576
  • 3
  • 13
  • 34
jmoyau
  • 27
  • 9
  • https://stackoverflow.com/questions/14976495/get-selected-option-text-with-javascript# – Ferhat BAŞ Aug 03 '20 at 21:56
  • ty @FerhatBAŞ, but don't need get the value of the option, i need the search value, i'm using data-live-search – jmoyau Aug 03 '20 at 21:58
  • Ok, i was my mistake, if you want to get input value as live you should use keyup event chnage event when input leaved than fired. – Ferhat BAŞ Aug 03 '20 at 22:05
  • @FerhatBAŞ don't worry, you have any example of the change event can help me? – jmoyau Aug 03 '20 at 22:08
  • i havent use asp but is there an input when you start search it has to added dynamically inspect it dev tools then catch classname or any indentically value and use keyup like this $('#Client findedindecallyvalue').keyup() – Ferhat BAŞ Aug 03 '20 at 22:13
  • @FerhatBAŞ sorry, but don't work, ty for your advice – jmoyau Aug 03 '20 at 22:34

1 Answers1

0

You can get the search value in live-search textbox by this:

$("#Client").change(function () {
    alert($(".bs-searchbox").find("input").val());
});
Li-Jyu Gao
  • 932
  • 6
  • 9