Enter button does not submit form (IE ONLY) ASP.NET

后端 未结 9 806
夕颜
夕颜 2020-12-01 10:17

I have a form with a textbox and a button. IE is the only browser that will not submit the form when Enter is pressed (works in FF, Opera, Safari, Chrome, etc.). I found th

相关标签:
9条回答
  • 2020-12-01 10:39

    There is a good write up of this problem here, and a nice jquery based solution:

    http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter

    0 讨论(0)
  • 2020-12-01 10:41

    This is due to a peculiarity in IE for single text field inputs.

    A simple solution is to stop the page having a single text field by adding another hidden one.

    <input type="text" name="hidden" style="visibility:hidden;display:none;" />
    

    see.. http://www.4guysfromrolla.com/articles/060805-1.aspx

    0 讨论(0)
  • 2020-12-01 10:43

    Hide the button - not using display:none, but with the following styles:

    position: absolute; /* no longer takes up layout space */
    visibility: hidden; /* no longer clickable / visible */
    

    If you do this, you won't need to add any other elements or hidden inputs.

    0 讨论(0)
提交回复
热议问题