gpt4 book ai didi

javascript - 第一次单击后禁用提交按钮

转载 作者:行者123 更新时间:2023-11-30 17:44:29 24 4
gpt4 key购买 nike

点击我网站上的“Contribute”按钮后,会出现一个覆盖表单;但是,如果有人在提供信息之前立即单击“发送 promise ”,则该按钮将被禁用(Stripe 按钮也是如此)以供进一步使用。结果,他们无法添加信用卡或提交表格;在他们刷新页面之前,它会被永久禁用。

如何更改它,以便“发送 promise ”按钮在第一次点击后仍处于事件状态?如果需要更多信息,请告诉我。

可在此处找到现场演示:http://www.cantedpictures.com/9test/

否则:这里是js:

$(function(){
$("#donateModal").on('show', function() {
// Fix StripeButton sizing bug on Firefox and IE
$(".stripe-button-inner, .stripe-button-inner iframe").width(132).height(36);
// ensure button scrolls with the rest of the page
$(".stripe-button-inner iframe").css('position', 'relative');
});

// Stripe Button Triggers formDomElement.submit().
// We intercept it and notify user we have received the token
var paymentForm = $('#payment-form')[0];
paymentForm.original_submit = paymentForm.submit;
paymentForm.submit = function() {
$("#stripe-button-holder .stripe-button-inner").html(
'<span class="label label-success">
<i class="icon-ok"></i> Card Added</span>');
return false;
};

$('#payment-form').validate({
rules: {
'first-name': {
minlength: 1,
required: true
},
'last-name': {
minlength: 1,
required: true
},
email: {
required: true,
email: true
},
amount: {
required: true,
min: 10,
},
'tos-agreed': {
required: true
}
},
messages: {
'tos-agreed': 'You need to agree to the Terms of Service',
'first-name': 'Please give us your first name',
'last-name' : 'Please give us your last name',
'email' : 'Please give us your email so that we can contact you',
'amount' : 'Please pledge at least $10.'
},
errorPlacement: function (error, input) {
$(input).closest('.controls').append(error);
},
highlight: function(el) {
$(el).closest('.control-group').addClass('error');
},
unhighlight: function(el) {
$(el).closest('.control-group').removeClass('error');
},
submitHandler: function(form) {
// ensure CC info has been entered
if (! $('[name=stripeToken]').val()) {
$("#stripe-button-holder").closest('.control-group').addClass('error');
$("#stripe-button-holder").append('<label class="error">
Please Add Payment Information</span>')
window.location.reload();
} else {
form.original_submit();
}
}
});
});//]]>

最佳答案

您应该识别您的按钮并将下面的 'button' 替换为 '#myButtonId',但是一旦您这样做就可以使用

$('button').prop('disabled', '');

删除禁用的属性。

关于javascript - 第一次单击后禁用提交按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20387565/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com