How can I make the following .keypress event handler work?
<p>I'm trying to run the following event handler listed below; it was originally a keydown function, but I need to configure the keypress instead. Can someone explain what I'm doing wrong here?</p>

<pre><code>$(document).on('keypress', function(event) { 
        if (event.shiftKey) {
            if (event.which === 37) {
                currentPosition = (currentPosition&gt;0) ?    parseInt(currentPosition)-1 : maxFocusablePosition;  
                console.log(' shift + left');

                focusPosition(currentPosition);  
                } 

            else if (event.which === 39) {
                currentPosition = (currentPosition&lt;maxFocusablePosition) ? parseInt(currentPosition)+1 : 0; 
                console.log('shift + right');

                focusPosition(currentPosition);  
                }

        }
    });
</code></pre>