Press enter directly to achieve the effect of clicking a button that triggers the click event
- 2020-03-30 02:08:30
- OfStack
//Press return triggers a click on a button
<input name="" type="text" class="input_search fl" id="searchkey" onkeydown="globelQuery(event);"/>
<div class="search_but fr" onclick="searchByKey()" id="globelSearch"> search </div>
http://img.blog.csdn.net/20140227095828937?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYmFpY3Az/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast
// Search return to achieve the click effect // Compatible with IE firefox Google
function globelQuery(e) {
if (!e)
e = window.event;
if ((e.keyCode || e.which) == 13) {
$("#globelSearch").click();
}
}