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

260
Vistas
How to know if an input is clicked and unclicked in Javascript

I'm trying to figure out how to know when an input is clicked and when it is unclicked. Let me explain:

When ever you want to type something on an input field, you click on the input box and when you don't want to type, you click somewhere else and the input field is disabled.

<input type='text'>

Here as you can see, when you click on it, the field is enabled, and when you click somewhere else other than the field, it disables.

I just want to know when the field is disabled/unclicked.

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

0

When you click on the input field focus event is fired. When you lose focus blur event is fired.

var elem = document.getElementById("fname")

elem.addEventListener("blur", myFunction);

function myFunction() {
  alert("Input field lost focus.");
}
<input type="text" id="fname">

about 4 years ago · Juan Pablo Isaza Denunciar

0

I believe you're just looking for onFocus.

<input type='text' onFocus={/* do something */} />

Read more about React events here.

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