I know this is a very old question, but I myself ran into a problem. The answer for me is to put event.preventDefault(); at the end of the select method as follows:
$("#txt1").autocomplete({ minLength: 1, source: "abc.php", select: function(event, ui) { //alert("Select"); var label= ui.item.label; var value= ui.item.value; $('#txt1').val(ui.item.label); event.preventDefault(); // <---- I moved! } });
For me, if event.preventDefault(); is placed at the beginning of the function, the event does not fire by default, and the rest of the function is not executed. If it moves to the end, then it works as expected. Hope this helps someone else.
Michael
source share