Hi I am trying to use a dropdown menu containing a list of countries – once selected it should automatically update a googlemap and zoom into that location.
e.g. if user selects ‘Brazil’ from the dropdown then the map should zoom into Brazil – any ideas on how to go about this – or any simple tutorials that explain this.
geocoder = new google.maps.Geocoder();
console.log(geocoder);
geocoder.getLatLng(
'Brazil',
function(point) {
if (point !== null) {
console.log(point);
centre = point;
}
}
);
You need a dropdown menu with geocoordinate value. if the dropdown change, it will call google map function.
Jquery