Use the Google Places Autocomplete Javascript API to show matching addresses near your location based on what is typed in the input field.
-
The demo.html file has 1 address field that when typed into will show matching addresses to select from.
-
The address input field has an id of 'address' which is used to bound to the 'autocomplete' object in the autocomplete.js file.
-
The 'initializeAutocomplete' method has to be called when google is ready, not just when the DOM is ready.
-
Create a new project under the Google API Console and enable the Google Maps Javascript API v3:
-
Create a new "Browser Key" and place that API key in your page like show in the bottom of the the demo.html file.
-
Don't forget to set your referrers field in the Google API credentials. You are limited to a certain amount of calls per day and you don't want others to be able to use your API key.
[Original Repo] (https://github.com/lewagon/google-place-autocomplete)