开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜