Definitive way to trigger keypress events with jQuery

后端 未结 10 2350
不知归路
不知归路 2020-11-22 00:33

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

10条回答
  •  梦谈多话
    2020-11-22 00:53

    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);
    

提交回复
热议问题