Tuesday, March 19, 2013

JQuery Autocomplete: event when suggestion is selected

There is an event when suggestion is selected, use the select event:

$("#username").autocomplete({
                            source: availableTags
                            , select: function( event, ui ) {
                                alert("hi");
                            }
                        });

Reference:
http://api.jqueryui.com/autocomplete/#event-select
http://stackoverflow.com/questions/7733315/jquery-autocomplete-event-select