Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

359
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!