I’ve the below HTML & JavaScript code:
Html:
<form action="#" method="post">
<input type="button" name="submit" value="Submit" class="submit_wide" id="myBtn" >
</form>
JavaScript:
$(".submit_wide").click(function () {
$(this).val('Please wait..');
$(this).attr('disabled', true);
setTimeout(function() {
$(this).attr('disabled', false);
$(this).val('Submit');
}, 2000);
});
I want this code to disable the button for 2 seconds, when the user clicks it which states ‘submit’. Can anyone tell me how to do it?