EasyUI Forum
March 29, 2024, 03:05:41 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: Numberbox not allowing onkeydown  (Read 6700 times)
bduguay
Newbie
*
Posts: 31


View Profile
« on: June 18, 2015, 09:47:25 AM »

I have some numberboxes that I have onkeydown events attached to. When I updated to jQuery-EasyUI 1.4.2 they no longer work.


Code:
search1 <input id="search1" class="easyui-numberbox" name="search1" style="width:200px"
  onkeydown="javascript:if (event.keyCode == 13) {window.alert('search1');}"/>
<br />
search2<input id="search2" class="easyui-validatebox" name="search2" style="width:200px"
  onkeydown="javascript:if (event.keyCode == 13) {window.alert('search2');}"/>
In the following fiddle I show how the  onkeydown event still works for the validatebox but not for the numberbox

http://jsfiddle.net/rpu36vo7/1/

Any help would be appriciated.
Thank you.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 18, 2015, 06:13:29 PM »

Please refer to this example http://jsfiddle.net/rpu36vo7/3/. It works fine.
Logged
bduguay
Newbie
*
Posts: 31


View Profile
« Reply #2 on: June 19, 2015, 05:35:19 AM »

I've added the code
Code:
$('#search1').numberbox('textbox').bind('keydown',function(e){
    if (e.keyCode == 13) {window.alert('search1');}

});

but now I get the following error in Firebug and the keydown is still not functioning.

Quote
TypeError: $.data(...) is undefined                                                                                                     jquery.easyui.min.js (line 6517, col 7)
      return $.data(jq[0],"textbox").textbox.find(".textbox-text");
------------^
Logged
bduguay
Newbie
*
Posts: 31


View Profile
« Reply #3 on: June 19, 2015, 05:57:39 AM »

Thank you for your assistance.

I have found that if I just use the onChange event of the numberbox, it will capture the enter key instead of trying to bind the enter key separately.
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!