Showing posts with label IE. Show all posts
Showing posts with label IE. Show all posts

Tuesday, April 10, 2007

Hidden submit buttons and IE

Internet Explorer has this annoying bug that breaks submit-on-enter-key if the submit button is not visible during page load. Setting it to display:none and using position:absolute;left:-5000px both cause this bug to appear.

Here's one solution (assumes all submit buttons have a class="submit"):

<!--[if IE]>
<style type="text/css">
.submit {
 height:0;
 width:0;
 overflow:hidden;
}
</style>
<![endif]-->

This doesn't work in Firefox, so make sure you sniff for IE when applying this technique.