Hold a keypress (Shift Key) in Javascript/Jquery

Hold a keypress (Shift Key) in Javascript/Jquery

Here we are not checking that the shiftkey is pressed or not. What i need is to press shiftkey on a function call

We have code where a key can be pressed on element keypress.

e = jQuery.Event("keypress"); e.which = 13 //choose the one you want $("#test").keypress(function(){ alert('keypress triggered'); }).trigger(e);

My requirement is Shift Key should be kept pressed on my function and released on another function called.

function called(){ .. code .. // need shift key pressed } function called_another_func(){ .. code .. // need shift key released }