Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The below code is working perfectly on click event to retrieve Lat/Long and Current Zoom level. How do I get the same when I hover mouse/drag on map Window (not on submit button)?

    <!DOCTYPE html>

var map;
function initialize()
var mapOpt = {
  center:new google.maps.LatLng(51.508742,-0.120850),
map=new google.maps.Map(document.getElementById("googleMap"),mapOpt);
function copyText()
google.maps.event.addDomListener(window, 'load',initialize);
google.maps.event.addListener(map, 'drag',copyText);


<input type= "text" ID=latlng>
<input type="text" ID=Zoom><br>
<button onclick="copyText()">Submit</button>

<div id="googleMap"style="width:400px;height:300px;"></div>

share|improve this question

I think this example here might be helpful for you.

It has the function to dynamically displays Lat/Long information when mouse moves which similar to what you are looking for.



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.