i am using Google Geocomplete to auto suggest my visitors when typing in cities.
It works well, but however it suggests country next to the city. For example, if i start to type Barce, it will suggest Barcelona, Spain. I need only Barcelona, without the country.
Does somebody know how to tell Geocomplete to show only cities without the country?
Thanks
I too faced the same problem
Here is the my solution, I hope this will help you.
1) Declare the option variable and types property.
for example,
var option = { types: ['(cities)'] };
and,
$("#input").geocomplete(option)
.geocomplete()
and then,
.bind("geocode:result", function(event, reuslt) {
console.log(result.name);
})
result.name is only show city name.
so, .bind inner function block add the this line.
$("#input").val(result.name);