Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle selected event in autocomplete textbox using bootstrap Typeahead?

I want to run JavaScript function just after user select a value using autocomplete textbox bootstrap Typeahead.

I'm searching for something like selected event.

like image 748
George Botros Avatar asked Sep 06 '25 11:09

George Botros


2 Answers

$('.typeahead').on('typeahead:selected', function(evt, item) {
    // do what you want with the item here
})
like image 88
drow Avatar answered Sep 08 '25 11:09

drow


$('.typeahead').typeahead({
    updater: function(item) {
        // do what you want with the item here
        return item;
    }
})
like image 30
Marcilio Leite Avatar answered Sep 08 '25 10:09

Marcilio Leite