html5 button提交兩次

點擊提交按鈕,頁面會提交兩次。

發生緣由:

在html5中,<button>中屬性type默認爲submit,因此,<button>會提交兩次。html

解決方案:

將<button>改成<input type='button'/>html5

spa

<button type='button'/>htm

相關文章
相關標籤/搜索