0

how I can do to fire the keypress event to an input element?. The event is triggered but I can not make it run completely, because not write the letter. I try the same recording the event, but I had the same problem.

<button>fire event</button>
<input id="test" />
<div id="info"></div>


$("#test").on('keypress', function(event){
    $('#info').append('<br />intro event: ' + event.keyCode);
});

$('button').on('click', function(event) {
    var e = $.Event('keypress', { keyCode: 102 } );
    $("#test").trigger( e );
});

test

Thank you.

Edit

I need is save all events that happen on my page and then able to fire. I have already complete the code to save the events, but my problem is how to fire.

andres descalzo
  • 14,887
  • 13
  • 64
  • 115
  • Not sure I get it, are you trying to do [***THIS***](http://jsfiddle.net/gXfeQ/) ??? – adeneo Jul 24 '13 at 17:05
  • Here's some information that may come handy [link](http://stackoverflow.com/questions/302122/jquery-event-keypress-which-key-was-pressed?rq=1). It seems that depends on the browser as well. – user2553780 Jul 24 '13 at 17:06
  • ^^^ normalized in jQuery ! – adeneo Jul 24 '13 at 17:06

0 Answers0