Js prevents users from submitting tools multiple times, and js prevents submission
Download, export, and other functions are often used during web development. When a user is operating on a network delay or a large amount of data, the user may experience slow response, and the operation will be deemed ineffective. Repeated clicks may cause multiple data loading and downtime, to avoid this, You can restrict your operations. For example, an operation can be performed once in five seconds.
Here is my method: it can be made into a public method for multiple js calls.
Js and jQuery used: Imports jQuery when using it.
Function delay (obj ){
Alert ("the button turns gray after you click it. It will be restored in 5 seconds !! "); // Prompt to the user
$ (Obj). attr ("disabled", "disabled ");
SetTimeout (function () {$ (obj). attr ("disabled", "");}, 5000 );
}
Put this method in the onclick event of the Import or Download button, for example, onclick = "dowloud (), delay (this);". Remember to add this.
If you want to use id, replace obj with ("# id name. But it is not universal and can only be used in one place. You need to change the id name in another place.