← Previous
Next →

IE6 submit-click on text input submit

John Tantalo
26 Sep 2008

Found this fun bug in IE6 today. If you have a text input and submit input unassociated with a form, then submitting the text input (by hitting return or enter when focused) will cause a click event on the submit input.

The solution is simple and intuitive: eliminate unassociated submit inputs and submit buttons.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/DTD/strict.dtd">
<input type="text"/>
<input type="submit" onclick="this.value='clicked';" />

Demo (IE only)