Geethika SJ
Geethika SJ

Reputation: 73

How to disable Stripe button

The Stripe button is shown using the below code:

<form action="" method="post">
  <script src="https://button.stripe.com/v1/button.js" class="stripe-button"
            data-key="<?php echo Yii::app()->params['publishable_key']?>"
            data-currency="GBP"
            data-amount=<?php echo $planDetails->amount?>
            data-description="<?php echo $PackageDetails->pkg_description; ?>"
            data-label="Update Payments">
            </script>
    </form> 

Its working fine now but I want to disable the button for trial users. How can I do so?

Upvotes: 1

Views: 3729

Answers (1)

MorKadosh
MorKadosh

Reputation: 6006

As far as I understand, you are looking for a plain js solution. You can easily do that:

document.getElementsByClassName("stripe-button-el")[0].disabled=true;

(This piece of code obviously assume you have only a single button with this class name)

http://jsfiddle.net/xfxn8bvx/ (notice that the script is running after DOM was loaded).

Upvotes: 4

Related Questions