How to disable submit button once it has been clicked?

后端 未结 18 1495
轻奢々
轻奢々 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:29

    I did the trick. When set timeout, it works perfectly and sending all values.

        $(document).ready(function () {
            document.getElementById('btnSendMail').onclick = function () {
                setTimeout(function () {
                    document.getElementById('btnSendMail').value = 'Sending…';
                    document.getElementById('btnSendMail').disabled = true;
                }, 850);
            }
        });
    

提交回复
热议问题