I\'m trying to build a mobile HTML5 webapp in which user can click on the map to get lat/long from Google Maps. Is there a code example? I tried googling but only found some
I want to show you complete answere:
this is main part of the code the event is based on click and get Lat/Long with click and show it at alert()
google.maps.event.addListener(map, 'click', function(event) { alert(event.latLng.lat() + ", " + event.latLng.lng()); });
please change your API KEY
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBu-916DdpKAjTmJNIgngS6HL_kDIKU0aU&callback=myMap"
put your API KEY between key= and &callback:
https://maps.googleapis.com/maps/api/js?key= @@@@@@@ &callback=myMap