#Benoît

1 messages · Page 1 of 1 (latest)

maiden ploverBOT
untold ocean
#

Hello! What do you mean by destroy? Can you tell me more about what you're trying to do?

vestal acorn
#

Hi ! Yes

untold ocean
#

Which might be what you're after?

vestal acorn
#

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

untold ocean
#

Can you share the code you're using to create the Payment Element?

vestal acorn
#

Sure

untold ocean
#

So paymentElement.destroy() doesn't work?

vestal acorn
#

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 ?

untold ocean
#

The .destroy() method exists on individual Stripe Element instances. If you have multiple Stripe Elements you need to call .destroy() on each one individually.

vestal acorn
#

Ok i understand

#

Indeed, it worked ! Thank you 👍

untold ocean
#

Awesome!