4

I try to embed google maps autocomplete in my script. As an example the api is asked to find "Neustadt" in Germany. There are a few possible matches to be shown. For that purpose this is fired:

google.maps.event.trigger(document.getElementById('search'), 'focus', {} );

The autocomplete text input expands and (hurray) the alternatives are shown. BUT if you click on one nothing happens. Expected behavior: Show the selected place.

Whats wrong? Any known cure?

Any hint appreciated a lot.

Kara
  • 6,115
  • 16
  • 50
  • 57
mife
  • 105
  • 1
  • 6

1 Answers1

3

There is no object in the Google Maps API V3 which has a 'focus' event. With google.maps.event.trigger(), you can only trigger the documented events. If you're trying to trigger an event in a DOM element you can do so directly, ie:

document.getElementById('search').focus();
Marcelo
  • 9,387
  • 3
  • 35
  • 40
  • 4
    I had it that way in the first place. That didnt work. But now I put a little delay before focus and that was it. – mife Oct 28 '12 at 06:06