Currently my fields look like this:
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);
}
}
<form class="got" method="GET" action="diar.hist.php" name="troca" onsubmit="return verifica()">
<input type="text" maxlength="10" placeholder="Data" name="Data_dd" OnKeyPress="formatar('##/##/####', this)" />
<button class="css_btn_class" type="submit">Atualizar</button>
</form>
If the user types only the numbers, it completes perfectly with the bars, however if the user types letters or symbols he accepts the same way. I wanted to limit the user to only enter numbers and that it formatted in date format as the same type.