I have a form which has one field username
. If some one submit the button "enter"
the next field pop up
. I have done using the jquery
. And it after entering the password
in that field when i click the "login" button
(input type of button is submit in both case) request goes to the server
. Every thing working fine for all browsers except firefox
. When someone click the login
button it works fine but when when i want to submit the form by hitting the enter key
nothing happens. Each time for submit in firefox
i have to use mouse. So, what can be the problem. I am not putting the code but it is simple form.

- 11,073
- 11
- 35
- 35
-
2If you want an answer you'll have to provide some code. – Will Vousden Dec 09 '10 at 14:56
3 Answers
The documentation for jQuery says:
Depending on the browser, the Enter key may only cause a form submission if the form has exactly one text field, or only when there is a submit button present
If those conditions are not met, you may need to assign a key listener and listen for the enter key. Also, I wouldn't be surprised if the "submit button" has to be an input of type submit, not a button... but I don't feel like testing it to confirm :-)

- 2,628
- 3
- 17
- 22
Are your next buttons actually <input type="submit">
buttons, or just regular <button></button>
buttons?
As per my recent question, the only way to process a form by pressing enter is to have 1) a sumbit button or 2) an onkeypress (or oninput) event in the input fields to listen for the enter key.

- 1
- 1

- 28,798
- 20
- 92
- 109
I may be wrong, but the solution to your issue may be to set the focus on the button:
document.getElementById('buttonID').focus()
Hope this helps.

- 1,355
- 1
- 11
- 30