Trigger key press event on a text field
===

I want to trigger key press event using jquery on a text field for the enter key.I am doing like:

    var key = jQuery.Event('keypress');
    key.keyCode = $.ui.keyCode.ENTER;
    $('#txtb').trigger(key);

It triggers the event successfully on firefox but fails on Chrome and IE.

When i capture the key in calling function it says undefined in chrome but works fine in mozilla.

Any help or suggestion would be greatly appriciated.

Thanks
Gaurav