I understand that in order to generate a place_changed event programmatically using the javascript Google Maps v3 API, you do the following:
google.maps.event.trigger(autocomplete, 'place_changed');
However, this simply calls the callback specified in the event, and actually does nothing with the <input> element that comes with it.
What I need to do is programmatically change the selection in the <input> autocomplete to a specific place or place specified in the place object obtained earlier with:
autocomplete.getPlace()
I can, of course, directly change the input value:
input.value = 'Whatever';
But that does not change the choice of autocomplete. After that, the user must delete the entire line in the <input> , and then finally start typing again to get the autocomplete predictions again.
So, to summarize, I would like to programmatically change the choice of entering autocomplete google maps using a place object derived from places / autocomplete api. Is there any way to do this?
javascript google-maps google-maps-api-3
Gordo
source share