easyui-combobox按enter键自动提交

来源:互联网 发布:供应链金融系统源码 编辑:程序博客网 时间:2024/06/14 10:27
原页面代码:<div id="CreateMakingDocumentsDialog" class="easyui-dialog" title=" " data-options=" "><input id="createMakingDocuments" name="makingDocuments" class="easyui-combobox" data-options="....."></div>html转换代码:<input id="createMakingDocuments" class="easyui-combobox combobox-f combo-f textbox-f"  data-options="...." textboxname="makingDocuments" style="display: none;" comboname="makingDocuments"><span class="textbox combo" style="width: 168px; height: 22px;"><span class="textbox-addon textbox-addon-right" style="right: 0px;"><a href="javascript:void(0)" class="textbox-icon combo-arrow" icon-index="0" tabindex="-1" style="width: 18px; height: 19.7778px;"></a></span><input type="text" class="textbox-text validatebox-text textbox-prompt" autocomplete="off" placeholder="" style="margin-left: 0px; margin-right: 18px; padding-top: 0px; padding-bottom: 0px; width: 147.778px;"><input type="hidden" class="textbox-value" name="makingDocuments" value="40288176_5b9dc977_015b_9eba8465_0068"></span>解决方法:可以看到原来input转为后有3个input,所以不管选择id还是name,都不合适。选择 id="CreateMakingDocumentsDialog" 的div下的input,添加keydown事件。$(function(){$('#CreateMakingDocumentsDialog :input').keydown(function(event) {var currKey=0,e=e||event; currKey=e.keyCode||e.which||e.charCode;if (currKey == 13) {CreateMakingDocumentsComit()}})});


                                             
1 0