The jquery setting button cannot be clicked to prevent repeated data submission

Source: Internet
Author: User
Tags time zones

Form interaction is indispensable in web development. In reality, there is such a bug. After you fill out the form, click the submit button. If the website is slow, the page does not jump for half a day, you can click the submit button without stopping, causing data to be submitted repeatedly. This probability is not negligible. The author will share with you how to prevent repeated submission.

Simply put, after you click the submit button, if all the data passes the verification and is qualified, you can submit data and set the button to not clickable.

Code that cannot be clicked for the jquery setting button (the setting id = phpernote button cannot be clicked ):

$("#phpernote").attr("disabled",true);

Or

$("#phpernote").attr("disabled","disabled");

Code indicating that the javascript setting button cannot be clicked (the setting id = phpernote button cannot be clicked ):

<Input onclick = "document. getElementById ('phpernote '). setAttribute ('Disabled ', true); "type =" button "id =" phpernote "value =" Submit "/>
Articles you may be interested in
  • How jquery ajax prevents repeated submissions
  • Javascript determines whether the mouse is left or right-click-compatible with ie, firefox, chrome, and other major browsers
  • Shoulder, back muscle group exercise-Bring Up-bend up rowing-Move up-Stand Up-Stand up weight bend up-Sit posture neck pull down-bend upright hold up-neck front wide hold up
  • PHP allows multiple second-level domain names on the same server to share SESSION data
  • Summary of several methods for setting time zones in PHP
  • In php, we use the curl post method to submit data and the get method to obtain webpage data.
  • Php clears (deletes) the files in the specified directory, and does not delete the directory folder.
  • Js: Click enter and move the cursor to the next input box.

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.