EasyUI Forum
May 03, 2024, 03:47:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Messager.prompt - Enter Key  (Read 5029 times)
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« 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
Logged
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« Reply #1 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();
}
}
);
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!