I want to run an Asp.net button click event (After clicking it) then disable it for 5 seconds and enable it again. I use this java script code but the click event code does not
check this out. https://jsfiddle.net/9ds9mL1v/5/
$("#Button1").click(function(){
var button =$(this);
var oldValue = $(this).value;
button.attr('disabled', true);
button.value = 'Wait 5 sec';
setTimeout(function () {
button.value = oldValue;
button.removeAttr('disabled');
}, 5000)
});
You can try this:
function lockoutSubmit(button) {
var oldValue = button.value;
setTimeout(function () {
button.setAttribute('disabled', true);
button.value = 'Wait 5 sec';
}, 0);
setTimeout(function () {
button.value = oldValue;
button.removeAttribute('disabled');
}, 5000);
}