Last active
April 5, 2022 16:03
-
-
Save IsaacAndres/bf2d18205fa1143f4eb7ab91299ed167 to your computer and use it in GitHub Desktop.
Validación caracteres permitidos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rut | |
oninput="this.value = this.value.replace(/[^0-9Kk.]/g, '').replace(/(\..*)\./g, '$1');" | |
// Numeros | |
onkeypress="return /[0-9]/i.test(event.key)" | |
// Letras | |
onkeypress="return /[aA-zZ ]/i.test(event.key)" | |
// maxLength | |
oninput="if(this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment