jQuery code tip #1

In some of our web application there is a need for keyboard interaction within the system that jQuery Lib make easy so here it snap of code that may be useful in such functionality:

 

        $(document).ready(function(){
            $(this).keydown(function(e){
                var evt = e || window.event;
                alert(String.fromCharCode(evt.keyCode?e.keyCode:e.charCode));
            });
            $(this).keyup(function(e){
                var evt = e || window.event;
                alert(String.fromCharCode(evt.keyCode?e.keyCode:e.charCode));
            });
        });