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

175
Vistas
jQuery: How does one bind a field to respond to non-keyboard changes before the field is deselected?

I have a jQuery app with an input text field that has events bound to it such that if the user changes the field then other related fields get updated accordingly. My goal is to make the other fields responsive to every character change. I initially bound the keyup event to the field which works pretty well on a desktop browser:

  1. If a user pastes to the field via typing Ctrl+V, the other fields are immediately updated via the keyboard events.
  2. If the user types into the fields, the other correlated fields are immediately updated with each keystroke.

This seemed perfect.

I noticed, however, when testing on a mobile browser, that if the user presses with their finger in the field and selects paste, the keyup event is not triggered. This isn't surprising since a keyboard isn't being used on the mobile interface. So I additionally bound change to the field. That worked OK, but the user still has to "deselect" the field after pasting for the change event to be triggered. While playing around with things, I noticed that even on the desktop, if the user pastes to the field with the mouse (right click > paste), then no events are triggered until the field is unselected.

Again, my goal is to make the field more responsive than this for these use cases (mouse paste and mobile paste to the field). Is there a keyboardless event I can bind to that will trigger when the user pastes to the field before deselecting the field?

Thanks.

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

0

The input event is what I want. I find that I can change from binding on keyup change to input and the field is responsive to any change to the field, either via keyboard, changes via the mouse, or touch screen events. Thus:

$("#id_name").on('input', function() {
    // Respond to the change in the field.
});
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