Definitive way to trigger keypress events with jQuery

后端 未结 10 2321
不知归路
不知归路 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:46

    Of you want to do it in a single line you can use

    $("input").trigger(jQuery.Event('keydown', { which: '1'.charCodeAt(0) }));
    

提交回复
热议问题