Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct listener for Jquery autocomplete

I am using the jquery autocomplete API , I am trying to get the value from a textbox after it is select . Which listener should I be using to get the value from the textbox . I tried .focus but it only works after the textbox is clicked again. I need this event to be triggered when the value from the drop down is selected (as opposed to the search words typed in the textbox)

like image 705
user1907343 Avatar asked Dec 06 '25 06:12

user1907343


1 Answers

If I understood your problem correctly, maybe you need to bind to the close event of autocomplete widget.

$("#autocomplete").autocomplete({
    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"],
    close: function (event, ui) {
        alert($(this).val());
    }
});

DEMO

like image 178
msapkal Avatar answered Dec 08 '25 20:12

msapkal