I have the following html code:
...
// javascript function
if(the user press the user box) {
// do some action
}
...
user: <input type="text" id="user" name="user" />
Email: <input type="text" id="email" name="email" />
There are 2 input boxes. When the user presses either input, it will call a JavaScript function to do something. I also want do some action when the user does something in the user box. However, I don’t know how to set up the condition.
Can anyone help me?
Could do something like this:
Note the use of this as an argument to the keyDown function, so you can have the one function handling both elements, but you can distinguish which one triggered the event.