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>
// 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) { 

Related articles: