EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: bduguay on June 18, 2015, 09:47:25 AM



Title: Numberbox not allowing onkeydown
Post by: bduguay 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.


Title: Re: Numberbox not allowing onkeydown
Post by: stworthy on June 18, 2015, 06:13:29 PM
Please refer to this example http://jsfiddle.net/rpu36vo7/3/. It works fine.


Title: Re: Numberbox not allowing onkeydown
Post by: bduguay 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");
------------^


Title: Re: Numberbox not allowing onkeydown
Post by: bduguay 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.