search

Home  >  Q&A  >  body text

Disable submit button after click: step-by-step guide

There is a submit button at the end of the form.

I have added the following conditions to the submit button:

onClick="this.disabled=true;
this.value='Sending…';
this.form.submit();"

But when jumping to the next page, the parameters are not passed and a null value is passed.

P粉818317410P粉818317410472 days ago583

reply all(2)I'll reply

  • P粉455093123

    P粉4550931232023-10-14 12:05:30

    You should submit the form first and then change the submitted value:

    onClick="this.form.submit(); this.disabled=true; this.value='Sending…'; "

    reply
    0
  • P粉133321839

    P粉1333218392023-10-14 11:51:54

    You may have submitted the form twice. Remove this.form.submit() or add return false at the end.

    You should end up with onClick="this.disabled=true; this.value='Sending…';"

    reply
    0
  • Cancelreply