how to disable the function of ESC key in JavaScript?
问题 In my chat application there are some text fields which gets the user login details. when filling the user details,If user suddenly pressed the ESC key,the data will be lost. I need to disable the function of ESC key ? which event I need to use ? how can I do that. my Java Script code is , function esc(e){ e = e || window.event || {}; var charCode = e.charCode || e.keyCode || e.which; if(charCode == 27){ return false; } } Searched a lot in Stack overflow and google.Nothing worked.Please any