Ben Ben - 1 year ago 63
HTML Question

How to trigger HTML button when you press Enter in textbox?

So the code that I have so far is:

<fieldset id="LinkList">
<input type="text" id="addLinks" name="addLinks" value="http://">
<input type="button" id="linkadd" name="linkadd" value="add">

It is not in a
and is just as it is within a
. However when I type something into the
called "addLinks" I want the user to be able to press Enter and trigger the "linkadd"
which will then run a JavaScript function.

How can I do this?


I did find this code, but it doesnt seem to work.

if(event.keyCode == 13){

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download