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

75
Views
localStorage.removeItem no elimina la fecha del campo de entrada

Tengo este código para guardar la Date en el almacenamiento local, pero mi localStorage.removeItem no funciona.
¿Puedes decirme qué estoy haciendo mal?

 let today = new Date().toISOString().slice(0, 10) document.getElementById("datata").value = getSavedValue("datata"); document.getElementById("exdated").value = getSavedValue("exdated"); function saveValue(e) { var id = e.id; var val = e.value; localStorage.setItem(id, val); } function getSavedValue(v) { if (!localStorage.getItem(v)) { return today; } return localStorage.getItem(v); localStorage.removeItem(v); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe eliminar antes de la declaración de return .

 let today = new Date().toISOString().slice(0, 10) document.getElementById("datata").value = getSavedValue("datata"); document.getElementById("exdated").value = getSavedValue("exdated"); function saveValue(e){ var id = e.id; var val = e.value; localStorage.setItem(id, val); } function getSavedValue (v){ if (!localStorage.getItem(v)) { return today; } var item = localStorage.getItem(v); localStorage.removeItem(v); return item; }
about 4 years ago · Juan Pablo Isaza Report
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!