EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: PaulMcGuinness on May 30, 2014, 04:41:02 AM



Title: Messager.prompt - Enter Key
Post by: PaulMcGuinness on May 30, 2014, 04:41:02 AM
Hi,

I know that the Enter key works by default for the messager.dialog, but I'd like it to fire off the function(r){} when I press the Enter key for messager.prompt (Input dialog) as well.

Any ideas?

Kindest regards,

Paul


Title: Re: Messager.prompt - Enter Key
Post by: PaulMcGuinness on June 09, 2014, 03:07:59 AM
Solved it myself...

after the normal message.prompt code:-

Code:
 
$.messager.prompt("enter a number","number",function(r)
 {
  if(r)
   {
    // your code
    }
  });

Add this:-

Code:
$('.messager-input').bind('keypress', function(e) {
if(e.keyCode==13)
{
$('body div.messager-body>div.messager-button').children('a.l-btn:first-child').click();
}
}
);