Definitive way to trigger keypress events with jQuery

events, javascript, jquery, keypress, triggers

Solution

If you want to trigger the keypress or keydown event then all you have to do is:

var e = jQuery.Event("keydown");
e.which = 50; // # Some key code value
$("input").trigger(e);

Problem

I've read all the answers on to this questions and none of the solutions seem to work. Also, I am getting the vibe that triggering keypress with special characters does not work at all. Can someone verify who has done this?

Original source

Related problems