I've written the following code that writes to the console "true" if the [Shift] was pressed on a keyup even and "false" otherwise.
<script>
var el = document.getElementById("myInput");
el.addEventListener("keyup", function (e) {
console.log(e.shiftKey);
});
</script>
For some reason, this code doesn't work when the event is triggered by pressing a number on the 10-key. If I hold Shift and press Numpad5, it logs false. I see the same behavior in Chrome, Firefox, and IE.
I need to be able to detect if the user is holding [Shift] when a number on the 10-key is pressed.
Edit: In response to @sagar's comment, I tested specifically with the keys 1-10 because that is what I expect my user's to press. Other keys will be ignored for the time being. I want to be able to tell when the user presses a key for a digit 1-10 and whether or not [Shift] was pressed.