I am working on a google maps application and tried to implement the autocomplete API.
It is working for 1 textfield.
Is it possible to add the same for the destinationfield without copying the code?
I added the listener as in the documentation
https://developers.google.com/maps/documentation/javascript/places
Here is the listener for the changed event,
but I don’t know, if I can bind it for 2 textfields..
google.maps.event.addListener(autocompleteStart, 'place_changed', function() {
//...
)};
You may use the function multiple times, a simple implementation: