Form submit by enter key and Internet Explorer

Related: Submit Form when no submit button is present in IE

Ran into an (other) interesting Internet Explorer bug. Seems that if you have a form with only a single text input, hitting the enter button will not submit the form in IE.

The solution is to hide an additional disabled input for IE to find, using IE conditional Comments and hiding it from view with some CSS.

Now the form will submit in IE when you hit the enter key!

49 Comments

  1. n.banerjee

    # December 17, 2010 - 6:48 am

    Hey thanks….It works!!

  2. R.N

    # February 27, 2011 - 7:59 am

    Thanks, man. You saved my job, it really works. Just another one of those wacky Microsoft bugs…

  3. surya

    # March 6, 2011 - 10:51 pm

    Wow..Excellent…

  4. Nghaka

    # March 25, 2011 - 12:05 am

    IE bugs. Major time wasting useless good4nothing…i could go all day. anyway, good job.

  5. Thomas Han

    # May 17, 2011 - 11:32 pm

    Just another hack to get pass the problem.
    The solution is not to add another hidden field.
    What you really need is to attach a default action on the form on submit!

  6. Jim Mayes

    # May 18, 2011 - 1:32 am

    please, elaborate

  7. mary

    # May 20, 2011 - 3:52 am

    Yes Thomas Han, please elaborate, you might have an alternative solution.

  8. Yie

    # May 27, 2011 - 2:06 pm

    First of all, THANKS for the solutions! I have been searching it and testing and finally only yours is working!

    HOWEVER…other Login pages (with different passwords and links) have logged in without entering the password. How could that happened? The only thing I added on that one page is:

    
    04.
    

    Which means I haven’t changed on other Login pages.

    Any idea? THANKS A LOT!

  9. Ersin Okkaya

    # June 3, 2011 - 3:03 am

    you are the man! Thanks a lot!

  10. ROck

    # June 20, 2011 - 5:36 pm

    Hey ! Thanks a lot it works and helped me …..

  11. Chris B. Behrens

    # July 28, 2011 - 3:24 pm

    This post is still delivering value two and a half years later…thanks.

  12. Caner Turhan Alp

    # November 2, 2011 - 4:40 pm

    Thank you very much, works great! ;)

  13. Jens

    # November 8, 2011 - 9:44 am

    Great! Thanks

  14. kashif aziz

    # November 22, 2011 - 8:00 am

    great — IE = headache for developers :(

  15. Dan

    # December 6, 2011 - 5:03 am

    Works perfectly, thanks!

  16. Bill

    # January 20, 2012 - 4:15 pm

    This funny MS bug cost me a day to find solution… until I see this page.
    Excellent, Thanks!

  17. Matt Smith, modMACRO

    # March 12, 2012 - 11:54 pm

    I wish there was a cleaner way, but haven’t found it yet. It works, and I can’t argue with results. Thanks for posting!

  18. [...] Thanks @Yaniro. It is a IE bug. [...]

  19. rosdi

    # June 28, 2012 - 3:52 am

    What do you know… it works!!.. I am using IE8 and it is still exhibiting this bugs.

    Thanks a bunch!

Leave a Reply