How can I simulate pressing a specific key on the document?
Important: without jQuery
With jQuery:
var e = $.Event('keydown');
e.which = 65;
document.trigger(e);
But how can I do this without jquery ?
How can I simulate pressing a specific key on the document?
Important: without jQuery
With jQuery:
var e = $.Event('keydown');
e.which = 65;
document.trigger(e);
But how can I do this without jquery ?
Use 'addEventListener' to capture this action
document.addEventListener('keydown',keydownfunction,false);
function keydownfunction(event){
// this function triggers on any keydown
}