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

130
Vistas
I could not perform the output of the value written to the input at the bottom

I want to see the input in a project and get the output at the same time. They did this only in the so-called way. But I want the output of my buttonless post. how to do?

<input type="text" id="myText">
<button type="button" onclick="myFunction()">Try it</button>
<p id="demo"></p>

  
<script>
  
// Here the value is stored in new variable x 
function myFunction() {
    var x = document.getElementById("myText").value;
    document.getElementById("demo").innerHTML = x;
}
</script>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can achieve your goal by using input_event on the input tag, like this:

let demo = document.getElementById('demo');
document.getElementById('myText').addEventListener('input',function(){
  demo.innerHTML= this.value;
})
#demo{ 
  background: #eee;
  min-height:20px;
}
<input type="text" id="myText">
<p id="demo"></p>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You should try to add an EventListener so every time the input changes the function will run.

Just add the following, I think it will work fine.

document.addEventListener('keydown', myFunction);

So on every key pressed the x variable will be assigned the current input.

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