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.
Bharat GuruAsked:
Who is Participating?
 
wasiftoorConnect With a Mentor Commented:
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.