0
I have a form where the user who is filling can include multiple mobile numbers, but my mask function works only in the first field.
var telMask = ['(99) 9999-99999', '(99) 99999-9999'];
var tel_1 = document.querySelector('#celular');
VMasker(tel_1).maskPattern(telMask[0]);
tel_1.addEventListener('input', inputHandler.bind(undefined, telMask, 14), false);
The problem is that only
tel_1
is receiving the "mask control". All phone fields need theaddEventListener
– rLinhares
But how can I put that all fields need {addeventlistener} if I don’t know how many fields will have
– Luiz Gustavo Costa Ceolin
Then you need to do this via dynamically; when creating a new field adds the event to it
– rLinhares
You have no other method than addeventlistener to apply to fields?
– Luiz Gustavo Costa Ceolin
It turns out you’re creating the fields and not adding the mask to them, you understand!?
– rLinhares
Which libraries are being used? I have one that can meet your need.
– user60252