Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda