1

Possible Duplicate:
Simulate Keypress With jQuery
Why trigger F11 press event doesn't work?

How to programmatically hit functional keys using jQuery? Is there any way to simulate the functional keys with jQuery?

Thanks, Naveen.

Community
  • 1
  • 1
1509
  • 75
  • 1
  • 2
  • 15
  • [vanilla solution](http://stackoverflow.com/questions/596481/simulate-javascript-key-events) – rlemon Apr 11 '12 at 16:48
  • You can't press functional keys via javascript. I often see this question asked in regards to pushing f11 to force full screen mode. Is this what you are after? – mrtsherman Apr 11 '12 at 17:20

1 Answers1

2
jQuery.trigger({ type: 'keypress', which: character });

And here is a list of the key codes you can pass

idrumgood
  • 4,904
  • 19
  • 29
  • 1
    This question should be closed. there are like 15 dupes of it out there already. We need to start pushing users to search the site before just asking a redundant question. – rlemon Apr 11 '12 at 16:56
  • Thanks for the answer, it gives the code of the corresponding key, but it doesn't functional, like if i want to simulate f12 key it shows me the corresponding code 123 but it did nothing. how to get the key functional. – 1509 Apr 11 '12 at 16:59
  • Please review the answers provided in the comments to your question. – rlemon Apr 11 '12 at 17:04
  • please have a look into the link http://jsfiddle.net/Rn3Ld/ – 1509 Apr 11 '12 at 17:18