HTML使用button的一个小坑

https://www.w3schools.com/TAGs/att_button_type.asp

Definition and Usage

The type attribute specifies the type of button.

Tip: Always specify the type attribute for the <button> element. Different browsers may use different default types for the <button> element.

<button type="button|submit|reset">

因为没有明确定义type,导致chrome和FireFox(webkit),以及 IE11,都把button的type默认设定为submit了,问题找了半天。

经过试验,多个button均不指定type时,chrome也都全设定type为submit。

http://www.w3school.com.cn/tiy/t.asp?f=html_form_submit

 

posted @ 2017-05-11 17:44  任国强  阅读(379)  评论(0编辑  收藏  举报