IE6 submit-click on text input submit

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)

Tags: ,

One Response to “IE6 submit-click on text input submit”

  1. [...] According to John Tantalo, “text input and submit input unassociated with a form” should be “text input and submit input each unassociated with a form” on http://www.johntantalo.com/blog/?p=32. [...]

Leave a Reply