EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: arma on October 06, 2013, 08:00:42 AM



Title: Close dialog or windows using escape key
Post by: arma on October 06, 2013, 08:00:42 AM
Is there a way to make dialog or windows response to escape key to close it?


Title: Re: Close dialog or windows using escape key
Post by: stworthy on October 06, 2013, 06:19:45 PM
Please bind 'keydown' event to dialog.
Code:
$('#dlg').dialog('dialog').attr('tabIndex','-1').bind('keydown',function(e){
if (e.keyCode == 27){
$('#dlg').dialog('close');
}
});