Скрипт Jquery для имитации нажатия клавиш без использования сочетания клавиш

Я хотел бы заранее поблагодарить вас за потраченное время и усилия. Итак, у меня есть скрипт, который должен имитировать событие нажатия клавиши через 3 секунды после загрузки страницы. Я хотел, чтобы это нажатие клавиши запускало комбинацию клавиш, но все, что он делает - просто нажимает клавишу. Как я могу заставить его на самом деле запустить ярлык после нажатия? Не уверен, что это вообще возможно. Еще раз спасибо.


 setTimeout( function(){
// jQuery plugin. Called on a jQuery object, not directly.
jQuery.fn.simulateKeyPress = function(character) {
  // Internally calls jQuery.event.trigger
  // with arguments (Event, data, elem). That last arguments is very important!
  jQuery(this).trigger({ type: 'keypress', which: character.charCodeAt(0) });
};

jQuery(document).ready( function($) {
  // Bind event handler
  $( 'body' ).keypress( function(e) {
    alert( String.fromCharCode( e.which ) );
    console.log(e);
  });
  // Simulate the key press
  $( 'body' ).simulateKeyPress('z');
});
 }, 3000); //3 seconds




// define a handler
function doc_keyUp(e) {

    // this would test for whichever key is 40 and the ctrl key at the same time
    if (e.ctrlKey && e.keyCode == 122) {
        // call your function to do the thing
        pauseSound();
    }
}
// register the handler 
document.addEventListener('keyup', doc_keyUp, false);

Ответы на вопрос(2)

Ваш ответ на вопрос