Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use javascript to click the enter key

Status
Not open for further replies.

elitehipster

Technical User
Feb 6, 2009
5

Hmm hard to explain what im trying to do...

Ok, so I am trying to find a javascript (since i dont have server side access) that clicks the "enter" button on the keyboard.

so like if i clicked a button on the webpage, with javascript it would execute the same thing as if i clicked the enter button on the keyboard.
 
What Dian said plus...

What exactly are you trying to acheive by clicking the enter button? Do you want to go to the next line in a text area, unfocus from a text area, submit a form???

You can't actually send a response the the browser that says the enter key was clicked (or any other key for that matter), but if you let us know what you are trying to do we may be able to help.

I.E.
If you want to mimic the letter A (caps) being pressed when a user is on a text field:

document.getElementById("tbxId").value = "A";



TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top