【问题标题】:Stripe.js V3 - prohibit double click (Enter key)Stripe.js V3 - 禁止双击(回车键)
【发布时间】:2019-05-28 16:33:56
【问题描述】:

大家好,新年快乐。

我在我的网络应用程序(PHP 7 / Laravel 5)上集成了 Stripe.js。

我使用 V3:Stripe.js 和 Elements:https://stripe.com/docs/stripe-js

   var form = document.getElementById('payment-form');
    form.addEventListener('submit', function(event) {
        event.preventDefault();

        $('#payment-form button').prop('disabled', true);
        $('#payment-form button').css('cursor', 'not-allowed');

        // ...
    });

这允许我禁用双击表单按钮。

但是如果用户按两次回车键,表单就提交了两次……

刚刚提交后,如何禁用stripe创建的输入类型文本?

谢谢。

【问题讨论】:

    标签: javascript php stripe-payments


    【解决方案1】:

    你可以做的是利用element.update(options)函数

    card.update({disabled: true/false});

    在这种情况下,应该禁用卡输入,但如果后端返回任何错误,您需要记住重新启用它。

    【讨论】:

    • 非常感谢
    猜你喜欢
    • 1970-01-01
    • 2017-11-11
    • 2011-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    • 2011-07-08
    相关资源
    最近更新 更多