Reputation: 9
is there a way to show only cities in a google map api autocomplete field?
At the moment we are using Geocode but unfortunately we receive even countries and addresses.
We even tried the following code
var input = document.getElementById('txt_city_and');
var options = {
types: ['(cities)']
};
autocomplete = new google.maps.places.Autocomplete(input, options);
and the error we receive is
Uncaught TypeError: Cannot read property 'Autocomplete' of undefined
-- Thank you
Upvotes: 0
Views: 2480
Reputation: 52
Please, ensure that
<script type="text/javascript" src="maps.google.com/maps/api/...
is placed before the script with the code that uses it
Upvotes: 0