Sometime we want to hide the popup or run any script by just pressing “Esc” key from the keyborad..
Here is simple code..
// hide popup model by pressing escape button
$( document ).on( 'keydown', function ( e ) {
if ( e.keyCode === 27 ) { // ESC
$('.popupimg').remove();
$("#nst-popup").hide();
}
});
});
You can change the script as per your need… 🙂