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

166
Visualizações
HTML & Javascript text changing

i was wondering how i could do the following:

  1. I get the input from the user using form(okay fine)
  2. i take that input and store it as a variable in javascript(got it).
  3. The variable i just saved changes the text of another page in the website (it permanently changes the text of that webpage and isn't depended on the js variable of that file anymore(it can also import the text into the web page if need be if possible)) for eg:- enter image description here

Here the user enters the details let's say the name for now

and then in the second img the text of the website changes, and when i download the second img website which doesn't hold the original js which stored the variable, it still shows the text as it might have stored the text in the file locally using js or something. [2]: https://i.stack.imgur.com/4nZCD.png

Please help me out.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In my experience, the best way to store information from page-to-page is through local storage.

Local storage persists from page to page, while JavaScript variables are cleared out, and cookies can be un-reliable based on the response from the server they are sent too.

In your function that takes the user input, write something along the lines of:

localStorage.setItem('myCat', 'Tom');

And to retrieve this information, you can reference it like:

const cat = localStorage.getItem('myCat');

Here is a reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

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