Esc key not detected in Chrome or Safari

Esc key not detected in Chrome or Safari

Not sure how to fix the problem of the Esc key not detected in Chrome or Safari; is detected in Firefox and IE.

  1. $(document).ready(function(){
  2. //LOADING POPUP
  3. //Click the button event!
  4. $("#button").click(function(){
  5. //centering with css
  6. centerPopup();
  7. //load popup
  8. loadPopup();
  9. });
  10. //CLOSING POPUP
  11. //Click the x event!
  12. $("#popupContactClose").click(function(){
  13. disablePopup();
  14. });
  15. //Click out event!
  16. $("#backgroundPopup").click(function(){
  17. disablePopup();
  18. });
  19. //Press Escape event!
  20. $(document).keypress(function(e){
  21. if(e.keyCode==27 && popupStatus==1){
  22. disablePopup();
  23. }
  24. });

  25. });
Any suggestions greatly appreciated...

Todd