Reputation:
I have a DOM element in my frame, and when I click on it, I want to simulate a ESCAPE key press (so I cannot use keydown or keyup, because its the click that generates it)
Is it possible?
Upvotes: 0
Views: 807
Reputation: 1708
If I'm not mistaken, the jquery trigger can be used with jQuery.Event object with type as keypress
Upvotes: 0
Reputation: 10715
With jQuery:
e = jQuery.Event("keydown");
e.which = 27; //27 = ESC
$("youelement").trigger(e);
Upvotes: 1