[ACCEPTED]-Select first jquery UI result automatically-jquery-ui-autocomplete
Accepted answer
Autofocus will highlight the first record..
Your code 1 would then just need to include autoFocus: true
, like below:
$('#txt_search_city').autocomplete({
source: url,
delay: 0,
autoFocus: true,
select: function( event, ui ) {
$( "#id_city" ).val( ui.item.id );
$(this).closest('form').submit();
},
focus: function( event, ui ) { event.preventDefault(); }
});
This seems to be outdated. I had the same 2 problem.
Just use .autocomplete({autoFocus: true})
I'm using jquery-ui-1.10.0.min 1 and it works now.
No plug is needed.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.