Hello, I want to use this GitHub library: https://github.com/jessepollak/card
I want to try to do something that I’m not sure if it’s doable.
For use this script, I need to specify “form” and “container” (example):
new Card({
form: document.querySelector('form'),
container: '.card-wrapper'
});
HTML example:
<div class="card-wrapper"></div>
<form action="">
<input placeholder="Card number" type="tel" name="number">
<input placeholder="Full name" type="text" name="name">
<input placeholder="MM/YY" type="tel" name="expiry">
<input placeholder="CVC" type="number" name="cvc">
</form>
So my plan is this:
1- Create input elements using js:
var x = document.createElement("INPUT");
x.setAttribute("placeholder", "Card number");
x.setAttribute("type", "tel");
x.setAttribute("name", "number");
Let’s say I have an input that the user decides when using it. So it’s not always on the screen, only when the user wants. So I can’t use that input to get the “card number”.
Instead of that my plan uses the x input as main input reader. (Example):
Main input value: 10
get that value and put it on the x input. x input is the input that is using the plugin, so the plugin will read the value of the main input using the x input.
Any ideas?
I was thinking of using the hidden type on the x input, but if I use it, how I will store the value?
Is it possible to store value on hidden value?
Thanks!!