http://codepen.io/abdulahhamzic/pen/YqMQwB
Is there a way to make it so that when I hit the enter key on a text input, it triggers a specific function? I attempted to achieve this using the following code:
<input type="text" onkeypress="clickPress()">
However, the issue I encountered was that I only want the function to be called when the enter key is pressed, not any other key. How can I accomplish this?
Update 2022: onkeypress
has been deprecated.
You can now use onKeyDown
instead.