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

161
Visualizações
Shelf life of numbers in inputs

I have friends of the multi-page application. On one page there is a calculator mode in which three actually have a text box. And in the first two, you enter values, and then in the third, you enter a number. Now if I enter numbers and move from the page, the numbers will be deleted. But I do not want this to happen and I want the numbers to remain in the text boxes

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

0

You can use

let names=['input1','input2','input3'];
function parseCookie(text) {
 if(text.length) {//if the length of the text is not 0
 let values={};
 for(let i=0;i<names.length;i++) {
  let namePos=text.indexOf(names[i]+'=')+names[i].length+1;
  values[names[i]]=text.slice(namePos,text.indexOf(';',namePos))
   }
 return values} else {return false}

  }
let inputs=document.querySelectorAll('input'); //get the input areas
let cookies=parseCookie(document.cookie)
if(cookies) {
 for(let i=0;i<names.length;i++) {
  inputs[i].value=cookies[names[i]];
  inputs[i].addEventListener('input',function() {document.cookie=names[i]+"="+document.getElementById(names[i]).value}++';expires=Thu, 18 Dec 3000 12:00:00 UTC')
   }
  }
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