I have a Google Autofill enabled input field. I would like to fill this field with some default values, focus the input and automatically open the forecast window below the input.
I obviously have no problem setting the input value and focus, but I cannot find a way to open the suggestion window. It opens at any press of a button; in any case, the simulation of a keypress event at the input did not work.
So, I am wondering if there is a way to trigger an event that the autocomplete window does.
I have the following code example:
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script> <input type="text" id="q" />
JS:
var input = document.getElementById('q'); var autocomplete = new google.maps.places.Autocomplete(input); $('#q').val('Rome, ').focus();
source share