muthu
muthu

Reputation: 5461

limit Google maps of countries in the autocomplete list to “Australia” but shows every one

I am using a Google API autocomplete. i try to restrict only for the Australia. But it suggests every cities in country.for example if i type "new" It suggests New York also. i don't want like that. I want to display only the cities in the Australia

The Working sample is in Jsfiddle.Thanks in advance

Upvotes: 1

Views: 2806

Answers (1)

Keval Domadia
Keval Domadia

Reputation: 4763

Too late to answer perhaps... But, this has worked for me: Put the following in your initialize() method

var input = document.getElementById('searchTextField');
var options = {
    types: ['(cities)'],
    componentRestrictions: {country: 'au'}
};

var autocomplete = new google.maps.places.Autocomplete(input, options);

Upvotes: 5

Related Questions