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

251
Visualizações
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
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