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
Javascript - Duplicate Field input

I'm trying to duplicate a field input like this in JSFiddle

But when I save the below in a html file, it is not working.

Can someone please assist?

<html>

<head>
<script>
$(function() { // <== Doc Ready
  $("#email").change(function() { // When email is changed
    $('#mail').val(this.value); // copy it over to mail
  });
});
</script>
</head>

<body>
<input type="text" name="email" id="email" />
<input type="text" name="mail" id="mail" />
</body>

</html>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Your function is working as expected.

The only issue with your code was the jQuery was not loaded to the snippet.

But instead of change, if you use keyup or input, you could see the changes right on time

Change will be triggered only when you focus away from your input.

$(function() { // <== Doc Ready
  $("#email").on('keyup', function() { // When email is changed
    $('#mail').val(this.value); // copy it over to mail
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" name="email" id="email" />
<input type="text" name="mail" id="mail" />

about 4 years ago · Juan Pablo Isaza Denunciar

0

This code will run for sure.

$(document).ready(function() {
    $('#email').keyup(function(e){
    $('#mail').val(e.target.value);
  })
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" name="email" id="email" />           
<input type="text" name="mail" id="mail"/>

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