Ardville Blog
Life is a game, enjoy it!
Life is a game, enjoy it!
26 Jul
Ran into an 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.
<form action="#" method="post"> <fieldset> <label for="user_name">User Name</label> <input name="user_name" id="user_name" type="text"> </fieldset> <fieldset class="button"> <button type="submit" name="submit" id="submit" title="Verify User Name">Verify User Name</button> </fieldset> </form>
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.
<form action="#" method="post"> <fieldset> <!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" /><![endif]--> <label for="user_name">User Name</label><input name="user_name" id="user_name" type="text"> </fieldset> <fieldset class="button"> <button type="submit" name="submit" id="submit" title="Verify User Name">Verify User Name</button> </fieldset> </form>
Now the form will submit in IE when you hit the enter key!