点击" Contribute"我的网站上的按钮,将出现一个叠加形式;但是,如果有人要立即点击“发送承诺”#34;在提供信息之前,按钮被禁用(与条纹按钮一样)以供进一步使用。因此,他们无法添加信用卡或提交表单;它会在刷新页面之前永久禁用。
如何更改它以便发送承诺"即使第一次点击后按钮仍然有效?如果需要更多信息,请告诉我。
可在此处找到实时演示: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();
}
}
});
});//]]>
答案 0 :(得分:2)
您应该识别您的按钮并将'button'
替换为'#myButtonId'
,但一旦您这样做,您可以使用
$('button').prop('disabled', '');
删除已停用的财产。