#Benoît
1 messages · Page 1 of 1 (latest)
Hello! What do you mean by destroy? Can you tell me more about what you're trying to do?
Hi ! Yes
There is a destroy() method on it: https://stripe.com/docs/js/element/other_methods/destroy
Which might be what you're after?
No, i tried this but its not Stripe JS Element, but Payment Element
I got an error with destroy()
elements.destroy is not a function
I have a use case where the Payment Element form has been created, and i need to remove it from my DOM (i don't want to hide it by CSS or something, i really want to destroy it)
I'd like to avoid removing the iframe myself, as i don't want to risk to keep some events attached etc etc. I'd like to make this the cleanest way possible
Can you share the code you're using to create the Payment Element?
So paymentElement.destroy() doesn't work?
Ah
I applied .destroy() to this._elements
I must apply it on paymentElement ?
Isn't a possibility to destroy the whole form in one shot ?
The .destroy() method exists on individual Stripe Element instances. If you have multiple Stripe Elements you need to call .destroy() on each one individually.
Awesome!