I have a javascript that does formatting form fields, it works well the most on mobile does not work.
Thanks for the help
<script>
function formatar(mascara, documento) {
var i = documento.value.length;
var saida = mascara.substring(0, 1);
var texto = mascara.substring(i)
if (texto.substring(0, 1) != saida) {
documento.value += texto.substring(0, 1);
}
}
</script>
<div class="row">
<div class="col-sm-7 col-md-7">
<div class="form-group col-md-3">
<label for="cpf">CPF:</label>
<input type="text" maxlength="14" OnKeyPress="formatar('###.###.###-##', this)" class="form-control" id="cpf" placeholder="Digite um valor...">
</div>
</div>
</div>