taw
taw

Reputation: 18831

Enter to reliably submit html form

I have a form with text input + gradient-shaded button with onclick='this.form.submit()' (plus some hidden inputs).

In all browsers, clicking on the button works.

In Firefox, if I click Enter while in text input, it submits the form. In IE, it does nothing.

How can I make it work with IE?

Upvotes: 0

Views: 153

Answers (3)

CharlesLeaf
CharlesLeaf

Reputation: 3201

If I remember correctly IE likes having an actual submit button, whether that's an <input type="submit" /> or <button type="submit">submit me</button>. Maybe you can put that in there but "out of sight" so you don't see it..

Upvotes: 1

Ta01
Ta01

Reputation: 31610

Create an empty text box, with a style of "visibility:hidden;display:none", this is a known issue

Upvotes: 1

Delan Azabani
Delan Azabani

Reputation: 81384

This type of form will always work with "Enter":

<form ...>
  ...
  <input type="submit" ...>
</form>

Make sure you have an input of type submit.

Upvotes: 0

Related Questions