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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top