当您按住某个键时,会keydown
在该键仍然按下时重复触发 javascript 事件。我想以编程方式模拟这种效果。我已经尝试了以下代码,但它只触发了keydown
一次事件:
e = jQuery.Event("keydown"); // define this once in global scope
e.which = 38; // Some key value
$("input").trigger(e);
任何帮助表示赞赏。
当您按住某个键时,会keydown
在该键仍然按下时重复触发 javascript 事件。我想以编程方式模拟这种效果。我已经尝试了以下代码,但它只触发了keydown
一次事件:
e = jQuery.Event("keydown"); // define this once in global scope
e.which = 38; // Some key value
$("input").trigger(e);
任何帮助表示赞赏。