Get mouse position coordinates

// Determine where mouse position is then output coordinates into two separate divs. $(document).mousemove(function(e) { currentMousePosX = e.pageX; currentMousePosY = e.pageY; $('#mouseX').text(currentMousePosX); $('#mouseY').text(currentMousePosY); });
Determine where mouse position is then output coordinates into two separate divs.

1 Response

I used code very similar to this ages ago on an outage map web site for a cable company, and then I lost it. So, SO handy! Thank you for sharing this!

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.