Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get latitude, longitude onclick of a map in google maps api v3 javascript?
    primarykey
    data
    text
    <p>how to know latitude, longitude on click of a map in google maps api v3. i have done this in google maps api v2 with this code</p> <pre><code> GEvent.addListener(map, "click", function(overlay, latlng) { if (latlng) { marker = new GMarker(latlng, {draggable:true}); GEvent.addListener(marker, "click", function() { //alert("hello"); var html = "&lt;table&gt;" + "&lt;tr&gt;&lt;td&gt;Name:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='name'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Time:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='time'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Bus Id:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='busId'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Device Id:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='deviceId'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type='button' value='Save &amp; Close' onclick='saveData()'/&gt;&lt;/td&gt;&lt;/tr&gt;"; marker.openInfoWindow(html); }); map.addOverlay(marker); } }); </code></pre> <p>how to do this same thing in v3?</p> <p>i tried this but it didn't work.</p> <pre><code>google.maps.event.addListener(map, "click", function(overlay,latlng) { if (latlng) { marker = new google.maps.Marker(latlng); google.maps.event.addListener(marker, "click", function() { var html = "&lt;table&gt;" + "&lt;tr&gt;&lt;td&gt;Name:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='name'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Time:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='time'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Bus Id:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='busId'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;Device Id:&lt;/td&gt; &lt;td&gt;&lt;input type='text' id='deviceId'/&gt; &lt;/td&gt; &lt;/tr&gt;" + "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type='button' value='Save &amp; Close' onclick='saveData()'/&gt;&lt;/td&gt;&lt;/tr&gt;"; marker.openInfoWindow(html); }); map.setMap(marker); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload