[ACCEPTED]-Select first jquery UI result automatically-jquery-ui-autocomplete

Accepted answer
Score: 45

Autofocus will highlight the first record..

Your code 1 would then just need to include autoFocus: true, like below:

    source: url,
    delay: 0,
    autoFocus: true,
    select: function( event, ui ) {
        $( "#id_city" ).val( ui.item.id );
    focus: function( event, ui ) { event.preventDefault(); }
Score: 10

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.

More Related questions