How to disable submit button once it has been clicked?

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

     
        A better trick, so you don't lose the value of the button is
    
        function showwait() {
        document.getElementById('WAIT').style['display']='inline';
        document.getElementById('BUTTONS').style['display']='none';
        }
     

    wrap code to show in a div

    id=WAIT style="display:none"> text to display (end div)

    wrap code to hide in a div

    id=BUTTONS style="display:inline"> ... buttons or whatever to hide with
    onclick="showwait();" (end div)

提交回复
热议问题