Stopping IE from highlighting the first submit-button in a form

前端 未结 6 1801
庸人自扰
庸人自扰 2020-12-03 18:12

The expected behaviour on enter in a form seems to be undefined in the HTML 4.01 Specification while the HTML 5 specification says it should be the first submit button in th

6条回答
  •  有刺的猬
    2020-12-03 18:31

    One way to get around this is to create a dummy button at the top of the form and move it out of sight. Then handle the enter keycode in javascript and style the new default button with css.

    Feels dirty though. Any better ideas?

提交回复
热议问题