[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

On click of a button how to disable button for 2 min and enabled it after 2 min.

On click of a button how to disable button for 2 min and enabled it after 2 min.
0
Bharat Guru
Asked:
Bharat Guru
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
Add a timer to your form. Set the Interval to 120000. Handle the Tick event of the timer. Within the Tick handler, re-enable the buttons. In your main button click, disable the other two buttons and start the timer.
0
 
wasiftoorCommented:
Simple Javascript should do the trick for you here. Please look at the code below:
_________________________________________________________________________________________
<input id="btn" type="button" value="click me" onclick="doSomething();"/>

<script>
function doSomething() {
  document.getElementById("btn").disabled=true;
  setTimeout('document.getElementById("btn").disabled=false;',60000);
  // do your heavy stuff here
}
</script>

Open in new window

0
 
Bharat GuruAuthor Commented:
if I add javascript function then my server side click function doesn't work.
can i see the sample where I can disable button only and continue the server side funtion call
0
 
wasiftoorCommented:
patel: if you can post how you are making that call we might be able to help.
0
 
Bharat GuruAuthor Commented:
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now