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

247
Views
How do capture a value from an input field, that was fed in from the `localStorage`?

How do capture a value from an input field, that was fed in from the localStorage?

My localStorage.getItem("PatientsName"); yeilds: "Vincent Ericsson"

I feed this value into my input field like this:

document.getElementById("Names").innerHTML = localStorage.getItem("PatientsName");

Below, in the browser console, is what my input group looks like in code:

<form action="/" class="form" method="post">
   <div class="input-group mb-3">
      <input type="text" class="form-control" id="Names" name="names">Vincent Ericsson</input>
   </div>
   
   <button type="submit" class="btn btn-secondary" id="submit">Submit</button>

</form

...and suprisingly, below is what the browser renders, which is an empty input field: an empty input field

I dont understand why the value Vincent Ericsson reflect only in the code, but is NOT rendered in the input field...

The environment I am developing this is Nodejs, so when I try to capture the value from the input field in code:

app.route('/')
   .get((req, res) =>{
      res.render('index');
})

   .post((req, res) => {
      console.log("You POSTED!");
      let userName = req.body;
      console.log("Names: " ,userName);
});

In the Terminal, the code above yeilds what you see below:

You POSTED!
Names: {
  name: '',
  
}

My question here is how do I successfully capture the value in the input field, in this instance Vincent Ericsson?

Looking forward to your help.

about 4 years ago · Juan Pablo Isaza
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!