How to disable beforeunload action when user is submitting a form?

前端 未结 7 2272
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 12:48

I have this little piece of code:



        
7条回答
  •  有刺的猬
    2020-11-28 12:57

    Use

    $('form').submit(function () {
        window.onbeforeunload = null;
    });
    

    Make sure you have this before you main submit function! (if any)

提交回复
热议问题