I am trying to do this:
$("#canvasDiv").mouseover(function() {
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
$(".filler").text("( e.pageX, e.pageY ) : " + pageCoords);
$(".filler").text("( e.clientX, e.clientY ) : " + clientCoords);
});
and in the console I get this:
Uncaught ReferenceError: e is not defined
I don’t understand… I thought e is supposed to be a variable that JavaScript has already set…help?
Change
to
True, the first parameter to the callback is pre-defined, but in order to use it you must alias it through an argument name. That’s why we specify
eas the argument. In fact, it’s not required that the argument name ise. This will work too:But you must alias the event object through the name
eventin the function callback.