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 executed. What is wrong with it? I am new with js.
function lockoutSubmit(button) {
var oldValue = button.value;
button.setAttribute('disabled', true);
button.value = 'Wait 5 sec';
setTimeout(function () {
button.value = oldValue;
button.removeAttribute('disabled');
}, 5000)
}
html:
<asp:Button ID="Button1"
runat="server"
Text="Send"
onclientclick="lockoutSubmit(this)" />
You can try this:
check this out. https://jsfiddle.net/9ds9mL1v/5/