I need to bind the 'enter' key on the keyboard to a specific javascript method, but ONLY when a certain text field is in focus.
<input id="post" type="text" style="width:400px;"/>
How would I do this?
I know you can do it with forms and stuff that have a submit action, but can I just bind the 'enter' key to a specific function when this above input
field is in focus?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…