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

92
Vistas
Clear icon event in text input on IE

that make up a currency converter, one with the number to be converted, the other receiving the converted number.

enter image description here

My question is: in IE in the input field, an X appears that if clicked allows the deletion of the value. I need to know how I do it (maybe with Javascript) at the click of the X I have to delete the result received in the other input field (see image).

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

0

There's no specific event handler available for the clear(X) icon. As a workaround, you can use the mouseup event to catch the change when you clear the input by clicking the clear(X) icon.

Sample code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    
</head>
<body>
    input1: <input type="text" id="ipt1" value="111" /><br />
    input2: <input type="text" id="ipt2" value="222" />
    <script>
            $("#ipt1").bind("mouseup", function (e) {
                var $input = $(this),
                    oldValue = $input.val();

                if (oldValue == "") return;

                // When this event is fired after clicking on the clear button
                // the value is not cleared yet. We have to wait for it.
                setTimeout(function () {
                    var newValue = $input.val();
                    if (newValue == "") {
                        $("#ipt2").val("");
                    }
                }, 1);
            });
    </script>
</body>
</html>

Result:

enter image description 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