简体   繁体   English

Easyui组合框按Enter自动清除框

[英]Easyui combobox press enter automatically clear the box

I have a problem with easyui combobox, when ı press enter after type, if value is do not exist in combobox, automatically clear the box. 我对easyui组合框有问题,在ı输入后按ENTER键,如果组合框中不存在值,则自动清除该框。 I cant get the text value. 我无法获取文字值。

How can i cancel it... 我该如何取消...

  <input class="easyui-combobox" id="productPK" name="productPK" style="width:200px"  required="required" data-options="valueField:'id',textField:'text'"/>

//script //脚本

var t = $('#productPK'); 
t.combobox('textbox').bind('keydown', function(e){
    if (e.keyCode == 13){   // when press ENTER key,           
      alert($(this).val()); 
    }
}); 

 $('#productPK').keyup(function(e){ if (e.keyCode == 13){ // when press ENTER key, alert($(this).val()); } }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-combobox/1.1.8/css/bootstrap-combobox.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-combobox/1.1.8/js/bootstrap-combobox.js"></script> <input class="easyui-combobox" id="productPK" name="productPK" style="width:200px" required="required" data-options="valueField:'id',textField:'text'"/> 

Please check if you want the same 请检查是否要相同

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM