Jump to content

onClick Disable submit button Help


coupe-r

Recommended Posts

Hi All,

 

I would like to have my submit button disabled on click, so the button cannot be pressed over and over again. 

 

I try using:

 

onclick="this.disabled=true;return true;"

 

But then nothing posts...  Any ideas?

 

If it isn't too much trouble, how would I change the value of the button to "processing..." AND disabled onClick?

 

Thanks

Link to comment
Share on other sites

what I would do is check for the form submission and then proceed to disable the submit button. I also recommend jquery for this. A simple solution could be,

 

document.getElementById("form_id").onSubmit = function() {
      document.getElementById("submit_id").disabled;
};

 

of course there is room to expand upon this, but this will do the trick.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.