I want to write a script which triggers an artificial keydown event (Shift + Arrow key) when button is clicked in jQuery.
$('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'.//
});
Is there a way to combain these two? That is, is there a key code for ‘Shift + Arrow key’ or any script for this to be done? I would appreciate any responses. Thank you.
The
shiftKeyproperty indicates that the shift key is pressed: