form表单内同时使用input和button踩坑

       踩坑:今天写表单的时候,意外发现input框输入完成后,按enter键会同时触发表单提交事件【也就是表单内未重新定义类型的button按钮(默认为submit类型)】

       解决办法:将表单内的button按类型都设成:type=“button”


<button type="button"></button>

参考文章

 

猜你喜欢

转载自blog.csdn.net/m0_48571414/article/details/128327570
今日推荐