我想写一个脚本,当在jQuery中单击按钮时触发一个人工keydown事件(Shift箭头键). $('button').click(function(){ $('body').trigger(jQuery.Event('keydown', {keycode:16})); //This line triggers a keydown for 'Shift'.// $('bo
$('button').click(function(){ $('body').trigger(jQuery.Event('keydown', {keycode:16})); //This line triggers a keydown for 'Shift'.// $('body').trigger(jQuery.Event('keydown', {keycode:38})); //This line triggers a keydown for 'Up Arrow key'.// });
有没有办法结合这两个?也就是说,是否存在“Shift箭头键”或任何脚本的关键代码?我将不胜感激任何回应.谢谢.
shiftKey属性表示按下shift键:$('body').trigger(jQuery.Event('keydown', { keycode:38, shiftKey: true }));