Home > Web Front-end > JS Tutorial > Enter directly to achieve the effect of clicking a button and trigger the click event_javascript skills

Enter directly to achieve the effect of clicking a button and trigger the click event_javascript skills

WBOY
Release: 2016-05-16 16:57:48
Original
1677 people have browsed it
Copy code The code is as follows:

//Enter to trigger a click event of a button
< ;input name="" type="text" class="input_search fl" id="searchkey" onkeydown="globelQuery(event);"/>
Search


http://img.blog.csdn.net/20140227095828937?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYmFpY3Az/font/5a6L5L 2T /fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast
Copy code The code is as follows:

//Search enter to achieve click effect//Compatible with IE Firefox and Google
function globelQuery(e) {
if (!e)
e = window.event;
if ((e.keyCode || e.which) == 13) {
$("#globelSearch").click();
}
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template