in my autocomplete select handler "focus()" doesn't work
Ok I have some autocompletes for some input fields, and I wanted to pass the focus to the next field over when the user makes a selection from the preceding inputs autocomplete list. So in my select handler, after setting all the field values I added a "focus()" but it doesn't work. Here's the code I'm using:
- // As soon as a certain div is opened, focus goes to my first field to which I also apply autocomplete
- $("input#db_street").focus().autocomplete({
- source: "mysource.php",
- minLength: 3,
- select: function(event, ui) {
- $('#db_street').val(ui.item.dug+" "+ui.item.duf);
- $('#db_dug').val(ui.item.dug);
- $('#db_duf').val(ui.item.duf);
- $('#db_CAP2').val(ui.item.CAP);
- // All the fields are getting correctly these values,
- // now I want focus to go automatically to the next field
- $('#db_civ').focus();
- // But for some reason it ain't happening
- return false;
- }
- });