Submit avoid submitting multiple times and require the button to be unavailable after submit

Source: Internet
Author: User
Submit avoid submitting multiple times and require the button to be unavailable after submit
Script function checkText () {var title = document. getElementsByName ('title') [0]. value; title = title. replace (/[]/g, ""); if (title! = "") {Return true;} else {alert ("cannot be blank! "); Return false ;}} script
 


 


How can I click submit to submit again?


Reply to discussion (solution)

Function checkText () {$ ("# go "). attr ('disabled ', true); // the submit button is invalid var title = document. getElementsByName ('title') [0]. value; title = title. replace (/[]/g, ""); if (title! = "") {Return true;} else {alert ("cannot be blank! "); Return false ;}}

You need to bind the form in JavaScript to submit this event, and write code in the callback function of this event to invalidate the button.

You need to bind the form in JavaScript to submit this event, and write code in the callback function of this event to invalidate the button.


Ah? It seems that it has never been changed.

This is a common single table page. when you click submit, the return page of the target program overwrites the original form.
Therefore, there is no issue of repeated click submission.

This requirement is required only when ajax is submitted.
In this case, you can set the deabled attribute of the submit button or use css to disable the display of the submit button.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.