[jQuery] Retrieving the location of the mouse click within the browser window

[jQuery] Retrieving the location of the mouse click within the browser window


I am trying to retrieve the location of the mouse click within the
browser window. When a user clicks on an area that they thought was
click-able but is not I want to record that location. There is a
similar application already out there called heat click but I would
like to create something more simpler in JQuery. I only need to add
this to a couple of pages to see where there may be some issues with
the layout of the web page. Right now I am using the following code
but it it returning the offset of the element which makes perfect
sense.
$(document).ready(function(){
$("#Form2").click(function() {
var loc = $(this).offset();
alert(loc.left + " - " + loc.top);
});
});
This always returns 0 - 0 which is the offset of the Form2.
Thanks

















    • Topic Participants

    • glen