Is there any way to get cursor position in custom function? I also know that the example bellow able to get the x and y.
$(".myelement").mousemove(function (e) {
var y = e.pageY - $('.myelement').offset().top;
console.log(y);
});
However my html is come from an ajax, so example is not working. So I was thinking about a custom function. But custom function not able to set an event, am I right? Is there any suggestion or other way to get cursor position in an element (div) ?