How do I trap and void ESC (CHR 27) keypress on my webpage?

How do I trap and void ESC (CHR 27) keypress on my webpage?

I would like to trap and void ESC keypress  by the following code:



            //Block ESCAPE Keys
            $(document).keydown(function (e) {
                if (e.keyCode == 27) return false;
            });

It does not seem to do anything. Also can some guide me if I void ESC keys this way, would Jquery dialogs which use CLOSEONESCAPE be affected? I want them not to be disturbed by this trap and dragnet that I want to set for ESCape key.