Reputation: 1
I want to prevent someone from clicking this button twice and triggering two form submissions which could result in duplicate payments on the server:
$("#SUBMIT_PAYMENT").button(
{
label: "SUBMIT PAYMENT",
text: true
});
Is there an option to make a jQueryUI button automatically disable itself after it is clicked?
Upvotes: 0
Views: 58
Reputation: 298512
I don't have much experience with UI, but this might work:
$("#SUBMIT_PAYMENT").button(
{
label: "SUBMIT PAYMENT",
text: true
}).one('click', function() {
$(this).button('disable');
});
Upvotes: 2