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

360
Vistas
How to display user input from one html page to another html page (javascript)

I have one HTML page (test.html)

<!DOCTYPE html>
<html lang="en"> 
    <head>
        <title>test</title>
    </head>
    <body>
        <input type="text" id="input-text" placeholder="Enter Text here"> <!--input text-->
        <input type="button" id="btn" onclick="addText()" > <!--call function-->
        <button ><a href="test2.html">Next Page</a></button> <!--get to new html page-->
    </body>
    <script src="app.js"></script>
</html>

and another HTML (test2.html)

<!DOCTYPE html>
<html lang="en"> 
    <head>
        <title>test2</title>
    </head>
    <body>
        <h1 id="header">Display input here</h1>
    </body>
    <script src="app.js"></script>
</html>

I want to go from one page to the other. The first page has an input, and the second page should display the input made by the user at the first page. This is the JavaScript:

function addText()
{
    document.getElementById('header').innerHTML 
    =document.getElementById('input-text').value;
}

How to display my user input from test page to test2 page?

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

0

Create a JSON object to store the data in localStorage. Then pull that data from the object when loading the next page.

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