/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(function() { $("#demo-box").click(function(e) { var offset = $(this).offset(); var relativeX = (e.pageX - offset.left); var relativeY = (e.pageY - offset.top); alert("X: " + relativeX + " Y: " + relativeY); }); });