摘要: html中设置<button></button>,该标签默认存在submit行为,当设置了onclick事件后,将会提交两次。 解决方法: 1:需要设置button type="button"即可; 2:在事件函数里面加入event.preventDefault();则可以取消form表单的默认跳转 阅读全文