How to simulate a keypress event in JavaScript?
Answers
By this you can..
A non-jquery version that works in both webkit and gecko:
var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";
keyboardEvent[initMethod](
"keydown", // event type : keydown, keyup, keypress
true, // bubbles
true, // cancelable
window, // viewArg: should be window
false, // ctrlKeyArg
false, // altKeyArg
false, // shiftKeyArg
false, // metaKeyArg
40, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.dispatchEvent(keyboardEvent);
or for more and good information you can go to google
◆◆◆◆◆●●●●●●●◆◆◆◆◆◆◆◆●●●●◆
#Hope it helps
# pleasure to help
# Be brainly....:)