I have a variable number of text fields to which I am initialising Google Maps Autocomplete dynamically.
The problem is that every time the place_changed event is fired, I need to know exactly which input box it was fired on. How can I pass this data to my saveLocation function?
Currently, event evaluates to undefined.
initAutocomplete = function (element) {
autocomplete = new google.maps.places.Autocomplete(
/** @type {!HTMLInputElement} */(element), {});
autocomplete.addListener('place_changed', saveLocation);
},
saveLocation = function (event) {
console.log(event);
var place = autocomplete.getPlace();
},