在做一个 chrome 插件时,发现里面的按钮 <button> 点击后会刷新页面,而用 <input type=button> 就不会。
后来查看 w3cschool 中 html 的 button 元素,原来<button> 也是要指定类型的 <button type=button> ,在 chrome 、firefox 等中,默认是 <button type=submit>
在做一个 chrome 插件时,发现里面的按钮 <button> 点击后会刷新页面,而用 <input type=button> 就不会。
后来查看 w3cschool 中 html 的 button 元素,原来<button> 也是要指定类型的 <button type=button> ,在 chrome 、firefox 等中,默认是 <button type=submit>