Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
164
rated 0 times [  168] [ 4]  / answers: 1 / hits: 49327  / 13 Years ago, sun, november 6, 2011, 12:00:00

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 website that does that but no soucecode example.



This is because I'm going to use HTML5 geolocation to display the current location first, but if it's not accurate then users can specify that by themselves.



Thanks a lot.


More From » html

 Answers
40

The code below will show you how to get the Long and Lat when the user clicks the map - Allow user to place marker on a google map



google.maps.event.addListener(map, 'click', function( event ){
alert( Latitude: +event.latLng.lat()+ +, longitude: +event.latLng.lng() );
});

[#89282] Thursday, November 3, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarod

Total Points: 62
Total Questions: 111
Total Answers: 83

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
jarod questions
;