Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

99
Vistas
How do I convert this to use event.code instead of event.keycode?

I need to change this so it isn't using the depreciated keycode?

if(event.keyCode >= 48 && event.keyCode <= 90) {
    //the key pressed was alphanumeric
}

I know how to do the a-z and the 0-9 but what about the special chars between (between 48 & 90 that are not a-z and 0-9)?

I'm sorry if this is a duplicate. I did look first but I didn't find anything that includes the "keys" between, only the a-z and 0-9. If it is a duplicate, could you share a link?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You could use regex if it doesn't need to be event.code.

if(event.key.match(/[^a-zA-Z0-9]/)) {
    //the key pressed was NOT alphanumeric
}

event.key:

The value of the key pressed.
Accounts for modifiers keys that return CAPS and alternate chars.

event.code:

The physical key on the keyboard.
Doesn't care if you are holding a modifier like Shift.

Ref: https://keycode.info/

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda