How to disable submit button once it has been clicked?

后端 未结 18 1493
轻奢々
轻奢々 2020-12-01 05:06

I have a submit button at the end of the form.

I have added the following condition to the submit button:

onClick=\"this.disabled=true;
this.value=\'         


        
18条回答
  •  情深已故
    2020-12-01 05:38

    Disabled HTML forms elements aren't sent along with the post/get values when you submit the form. So if you disable your submit button once clicked and that this submit button have the name attribute set, It will not be sent in the post/get values since the element is now disabled. This is normal behavior.

    One of the way to overcome this problem is using hidden form elements.

提交回复
热议问题