开发者

Is there an option to turn a jQueryUI button into one that automatically disables itself when clicked?

开发者 https://www.devze.com 2023-04-06 23:14 出处:网络
I want to prevent someone from clicking this button twice and triggering two form submissions which could result in duplicate payments on the server:

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 aft开发者_JS百科er it is clicked?


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');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号