//回车事件绑定 $(".left-content").keyup(function(event){ var theEvent = event || window.event; var code = theEvent.keyCode || theEvent.which || theEvent.charCode; if(event.keyCode ==13){ $(".textbox-addon").click(); } });
//回车事件绑定 $("#search-div").bind("keydown",function(e){ // 兼容FF和IE和Opera var theEvent = e || window.event; var code = theEvent.keyCode || theEvent.which || theEvent.charCode; if (code == 13) { //回车执行查询 $("#terminalList-search-btn").click(); } });
<div id="search-div"> <input type="hidden" id="shipInfo_edit_shipId" value="${shipId}"> <fieldset> <legend>${message("ov.terminalInfo.search")}</legend> <form id="terminalList-search-form" class="search-form"> <input type="text" class="easyui-textbox" name="terminalId" validtype="length[0,20]"/> <input type="text" class="easyui-textbox" name="number" validtype="length[0,20]"/> </form> <div class="search-item"> <button id="terminalList-search-btn" class="easyui-linkbutton" data-options="iconCls:'icon-search'">${message("ov.search")}</button> </div> </fieldset> </div>