i want to listen for a key stroke, then output the pressed key into every span element inside class=letter element using jquery. at the same time i want to preserve basic functionality of the keyboard shortcuts native to the browser eg. shift + cmd + ]; cmd + r; ctrl + tab etc...
<div class="letter">
<span>a</span>
</div>
this jQuery works very well on detecting and outputing the keystrokes that i am after.
$(window).on("keypress", function (e) {
var t = e.which || e.keyCode;
if (e.which === 0 && e.keyCode > 0) return;
var n = String.fromCharCode(t);
$(".letter").find("span").html(n);
e.preventDefault();
});
now i need to exclude somehow the shortcuts but i want to keep the e.preventDefault(); line as it's muting the "wrong button" sound...