jQuery pageX and pageY returns the position of an event occured
click event coordinates
The following code uses event.pageX/pageY to get click event coordinates.
<html>
<head>
<script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!--from ww w . j a v a2 s . c om-->
$("h1").bind("click", function(e){
var str = "( " + e.pageX + ", " + e.pageY + " )";
$("h1").text("Click happened! " + str);
});
});
</script>
</head>
<body>
<body>
<div><h1>java 2s.com</h1></div>
</body>
</html>