![]() |
Using JavaScript to Simulate Enter
Is it possible to use JavaScript to automatically press the Enter key when a textfield's value is changed? I'm guessing I would need to call the function using onChange="functionexample".
After some research I found out the the map number for the Enter key is 13. I think this is the number JavaScript needs, I could be wrong. |
why do you want to press enter?
|
I have a form which has a section to choose a door number, each numeral is charged at £2.00. I have a script that calculates the amount of digits and that value is placed in a textfield.
I also have another textfeild that shows the total value of the order, but the problem is that the total value won't update when the amount of digits changes. If you click in the field with the amount of digits and press enter it updates the total value. This was just a way round it I could think of. |
i ask because pressing enter usually triggers a form submit or onchange event.
if that's the case, you can simply call form.submit() or input.onchange() - no reason to fake key presses... in other words, just do what enter does, don't do enter. post the code if you need a hand. |
Ah I see.
Just need to clarify where I should call this function? Should it be on:
I was going to post the code, but it's too long. If you really need it to help me I will upload a text file. |
| All times are GMT +1. The time now is 07:42 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.