Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

365
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda