Simulate Keypress With jQuery

The keypress event from jQuery is meant to do this sort of work. You can trigger the event by passing a string “keypress” to .trigger(). However to be more specific you can actually pass a jQuery.Event object (specify the type as “keypress”) as well and provide any properties you want such as the keycode being the spacebar.

http://docs.jquery.com/Events/trigger#eventdata

Read the above documentation for more details.

Leave a Comment