EasyUI Forum
September 14, 2025, 06:10:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how do I choose "cancel" with other keys in Messager.confirm ?  (Read 6357 times)
noerone
Newbie
*
Posts: 13


View Profile
« on: March 05, 2016, 10:07:21 PM »

I want to ask about Messager.confirm .

usually when I want to select cancel , I use the tab key on the keyboard . how do I choose cancel with other keys ( example : right arrow )
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 06, 2016, 01:20:44 AM »

The code below implements the navigating feature using the 'LEFT' and 'RIGHT' keys.
Code:
<script type="text/javascript">
(function($){
function nav(delta){
var win = $('body').children('div.messager-window');
if (!win.length){return}
var buttons = win.find('.messager-button .l-btn');
for(var i=0; i<buttons.length; i++){
if ($(buttons[i]).is(':focus')){
var index = i + delta;
if (index > buttons.length-1){
index = 0;
} else if (index < 0){
index = buttons.length-1;
}
$(buttons[index]).focus();
return false;
}
}

}
$(document).bind('keydown', function(e){
if (e.keyCode == 39){ // right
return nav(1);
} else if (e.keyCode == 37){ // left
return nav(-1);
}
})
})(jQuery);
</script>
Logged
noerone
Newbie
*
Posts: 13


View Profile
« Reply #2 on: March 06, 2016, 01:52:05 AM »

Thanks Jarry. It's work  Grin

[Thread Closed]
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!