jquery绑定回车事件

 //回车事件绑定
$(".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>
上一篇:Solr4.8.0源码分析(26)之Recovery失败造成的宕机原因分析


下一篇:php面试题--并列排名问题