0
I am studying Jquery and I came across a logic activity, I need to allow the user to only type the 123456 keys in the input.
html code:
<h3>Teclado</h3>
<span>Nome:</span>
<input type="text" id="teclado" />
<span id="resultadoTecla">Resultado do evento sobre o input</span>
jquery/javascript code
$('#teclado').keyup((e) => {
if(e.keyCode >= 97 && e.keyCode <= 102){
var number = $(e.target).val();
$(e.target).val(number);
console.log('log 1: ' + number);
} else {
}
})
I started the logic, but I don’t know how to prevent other values.
Thank you for your explanation, it helped me a lot, it was really something like this I was looking for, now I need to study a little more JS to know how to use replace correctly.
– sahusa