Невозможно создать кнопку Отключить, пока флажок не установлен с помощью функции чередования - PullRequest
0 голосов
/ 07 апреля 2020

Я пытаюсь сделать это пятью разными формами, но не могу решить эту проблему.

Я хочу Отключить кнопку проверки, пока флажок не установлен. Потому что я могу поставить флажок Stripe Checkout, не так ли?

Большое спасибо, я жду вашей помощи.

<!-- Load Stripe.js on your website. -->
<script src=></script>

<!-- Create a button that your customers click to complete their purchase. Customize the styling to suit your branding. -->
<div>
  <input type="checkbox" name="option-1" id="option-1"> <label for="option-1">Option 1</label>
</div>

<button style="background-color:#FF8500;color:#FFF;box-shadow: 0 12px 16px 0 rgba(0,0,0,0.50),0 10px 70px 0 rgba(0,0,0,0.16);padding:8px 12px;border:0;border-radius:4px;font-size:12px" id="checkout-button-plan_" role="link">
  Comprar ahora 9,99 €/mes
</button>

<div id="error-message"></div>

<script>
  var checkboxes = $("input[type='checkbox']"),
    checkout - button - plan_Gxp215C0idrfZb = $("input[type='submit']");

  checkboxes.click(function() {
    checkout - button - plan_Gxp215C0idrfZb.attr("disabled", !checkboxes.is(":checked"));
  });

  (function() {
    var stripe = Stripe('pk_test_');

    var checkoutButton = document.getElementById('checkout-button-plan_*');
    checkoutButton.addEventListener('click', function() {
      // When the customer clicks on the button, redirect
      // them to Checkout.
      stripe.redirectToCheckout({
          items: [{
            plan: 'plan_',
            quantity: 1
          }],

          // Do not rely on the redirect to the successUrl for fulfilling
          // purchases, customers may not always reach the success_url after
          // a successful payment.
          // Instead use one of the strategies described in
          // https://stripe.com/docs/payments/checkout/fulfillment
          successUrl: 'https://w',
          cancelUrl: 'https://www.',
        })
        .then(function(result) {
          if (result.error) {
            // If `redirectToCheckout` fails due to a browser or network
            // error, display the localized error message to your customer.
            var displayError = document.getElementById('error-message');
            displayError.textContent = result.error.message;
          }
        });
    });
  })();
</script>
...