Triggering a JavaScript click() event at specific coordinates Triggering a JavaScript click() event at specific coordinates javascript javascript

Triggering a JavaScript click() event at specific coordinates


Set the pageX and pageY properties (which are normalized) on the event object and pass it to .trigger(), like this:

var e = new jQuery.Event("click");e.pageX = 10;e.pageY = 10;$("#elem").trigger(e);


The ".trigger()" call accepts an "extraParameters" parameter that you could use to stuff the XY coords in I would think. Documentation

.trigger("click", [x, y]);