jquery綁定回車事件
阿新 • • 發佈:2018-06-09
jquer char -i ali form hid ear lds class
//回車事件綁定 $(".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>
jquery綁定回車事件