#balconytom-payment element
1 messages ยท Page 1 of 1 (latest)
clientSecret: clientSecret,
appearance: {/*...*/},
loader: 'always',
};
const elements = stripe.elements(options);
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
paymentElement.on('change', (event) => {
//do sth
console.log("changed");
debugger;
});```
I have this simple piece of code, however when I put the debugger in the element doesn't render
you mean when you add the debugger keyword in the 'change' event listener?
yep
do you have any errors in your console at that time?
nope
I think what's happening is that the debugger is pausing the render of the payment element if you have your console open
first try closing your devtools but keep the debugger
if that works, this means that you just need to press the play button to skip the debugging at that stage
until the element is loaded
or better, you could open the devtools after the page/the payment element has loaded
ok, that works, thx. It would not load after the first play when the devtools were open on the initial load
you would have to press play multiple times I guess
the idea is that when you put a debugger, this command would stop the browser from executing what's next on the queue, and each time the "change" event fires you are asking the browser to halt
I get the idea, it's that on the first load the debugger efectively stops the render, and even after pressing play it doesn't go on with the redner, just hangs in loading state, which was surprising
it might be triggered multiple times
so you might need to press the play button multiple times
it's just once and the play button is gone afterwards
but nvm, got the workaround working so I can play now ๐
I'm glad I could help. let me know if you need any more help