J query

Disable Button After Click with jquery

1. Add Below J query In page

$(document).on(“click”, “#<%= btnaddtocart.ClientID %>”, function (e) {
if (typeof Page_IsValid != “undefined” && Page_IsValid == true) {
document.getElementById(‘<%= btnaddtocart.ClientID %>’).value = “Wait…”;
document.getElementById(‘<%= btnaddtocart.ClientID %>’).className = “”;
var button = this;
$(button).css(‘width’, ’76px’);
setTimeout(function () {
$(button).attr(‘disabled’, ‘disabled’);
}, 1);
}
else if (typeof Page_IsValid == “undefined”) {
document.getElementById(‘<%= btnaddtocart.ClientID %>’).value = “Wait…”;
document.getElementById(‘<%= btnaddtocart.ClientID %>’).className = “”;
var button = this;
$(button).css(‘width’, ’76px’);
setTimeout(function () {
$(button).attr(‘disabled’, ‘disabled’);
}, 1);
}
else {
$(button).attr(‘disabled’, ”);
}
});

1 thought on “Disable Button After Click with jquery”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.