javascript - esc key event for jquery dialog -


have jquery dialog closeonescape false. want trigger event based on esc key press how achieve it? on not working

 $(document).on("keypress","#popupid",function(e) {         debugger;         if (e.keycode === 27) {             alert("esc key triggered");         }     }); 

$(document).keypress(function(e) {       if (e.keycode==27){      //do smth  }});


Comments