-3
I’m stuck on a question here and I need a help.
I need to make an autocomplete in a boleto input.
Example:
12345.56789.00085.111111.11111.234566.6.0000000000
In this last field, if the user does not type anything he would have to autocomplete with "0".
If this were the case:
12345.56789.00085.111111.11111.234566.6.123
The input would have to return:
12345.56789.00085.111111.11111.234566.6.12300000000000
Always autocomplete with zeros to the right.
How can I do this in javascript?
Post part of your code so we can help you better.
– David Alves
Is there a pattern that there? When zero numbers on the right? Do the points continue as points? I think that there will need a mask, nor
.repeat(14-num.length)
and neither.padEnd(54, "0")
will solve your real problem (I think, not sure). Please edit the question and make these points more clear.– Guilherme Nascimento
In the case in my code already has this rule of allocating the "." to separate and yes is in the last field, in the case 14 digits. The problem that users sometimes forget to put the number zero, invalidating the ticket. Then it is to autocomplete until the required amount of character is: 54
– heyapplebear