0

The issue is that i should emulate a tap event without the using of jQuery to call it's handler. The handler is attached so:

$(element).on("tap",".class", handler);

I've tried so:

event1 = document.createEvent('MouseEvents');
event1.initMouseEvent('click', true, window, 1, 0, 0, 0, 0, false, false, false, 1, document.body.parentNode);
element.dispatchEvent(event1);

and so (also for touchend):

event2 = document.createEvent("TouchEvent");
event2.initEvent("touchstart", true, false);
element.dispatchEvent(event2);

but it doesn't work.

I am not sure what is inside the wrapper for the tap event of jQuery.

Could somebody help? Thanks a lot.

4

0 に答える 0