#rssv

1 messages · Page 1 of 1 (latest)

scenic bayBOT
haughty agate
#

var card_num = elements.create('card');
card_num.mount('#card_num');

knotty fox
#

What do you mean by 'clears the parent'?

haughty agate
#
<div class="text-box-container 8l6kgi" id="card_num">
  <input type="text" autocomplete="off" class="text-box svelte-8l6kgi" id="card" placeholder="Card number">
  <div class="text-box-underline svelte-8l6kgi"></div>
  <div class="text-box-buttons svelte-8l6kgi"></div>
</div> ```
#

Let's say this is the input I want to shown in payment form,

#

```<div class="text-box-container 8l6kgi" id="card_num"> <div class="text-box-underline svelte-8l6kgi"></div> <div class="text-box-buttons svelte-8l6kgi"></div></div>````

#

I set it up like this, but whenever I mount the input from JS

card_num.mount('#card_num');

It clears the inline elements

knotty fox
#

Are you using some kind of third-party Svelte lib for Stripe.js?

haughty agate
#

My website used to built with Svelte, but it's currently native js & html (dumped the website, class names remains same as svelte), so no.

knotty fox
haughty agate
#

Downloaded JS from website, examples -> custom-payment-flow -> html -> card

knotty fox
#

Stripe.js doesn't really work with these frameworks out of the box, and we don't have an official Svelte lib (only React)

haughty agate
#

Website is not Svelte anymore.

#

Like I said, I dumped the website after fully loaded, it's native JS

knotty fox
#

Then you'll need to provide me with a reproduction of the issue because I'm not fully understanding it

haughty agate
#

.appendChild appends an element to desired element

#

.innerHTML changes the html of desired element

#

I want to append stripe card number input into a div, but it's behaviour same as innerHTML

knotty fox
#

None of your code you shared includes that, hence why I've asked for a reproduction

haughty agate
#
document.getElementById('card_num').innerHTML = card_num;
document.getElementById('card_num').appendChild(card_num);
#

card_num.mount('#card_num');
This code behaves like innerHTML one, I want to use it as second one

#

Nevermind then, I can add the rest of HTML by myself

knotty fox
#

Yeah, not really sure what you're trying to do exactly but the Elements are pretty locked down and you can't really mutate them directly via JS

haughty agate
#

That was my question.

#

Thanks for the helping tho