Onfocus for a textbox and button

  • Thread starter Thread starter Do
  • Start date Start date
D

Do

Hi,

When a user puts the focus(cursor) into a particular textbox on my page,
I want the button to have focus once the user presses the return key.
Right now, nothing happens when the user presses the return key.

Do
 
Using JavaScript, you can trap the OnKeyPress event of the document, and
then call a function that checks for window.event.keyCode == 13, in which
case you can set the focus to whatever control you want to.
 
Back
Top