Disable submit button ONLY after submit

前端 未结 13 691
囚心锁ツ
囚心锁ツ 2020-12-02 22:49

I have the following HTML and jquery:






Test disabling submit button fo

13条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 23:40

    Reading the comments, it seems that these solutions are not consistent across browsers. Decided then to think how I would have done this 10 years ago before the advent of jQuery and event function binding.

    So here is my retro hipster solution:

    
    

    The main point of difference is that I am relying on the ability to stop a form submitting through returning false on the submit handler, and I am using a global flag variable - which will make me go straight to hell!

    But on the plus side, I cannot imagine any browser compatibility issues - hey, it would probably even work in Netscape!

提交回复
热议问题