开发者

Enter to reliably submit html form

开发者 https://www.devze.com 2023-01-01 06:57 出处:网络
I have a form with text input + gradient-shaded button with onclick=\'this.form.submit()\' (plus some hidden inputs).

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 I开发者_如何转开发E, it does nothing.

How can I make it work with IE?


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..


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


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

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

Make sure you have an input of type submit.

0

精彩评论

暂无评论...
验证码 换一张
取 消