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

82
Views
el elemento li desaparece después de recargar la página

Estoy tratando de agregar un elemento li en el div a continuación (la funcionalidad es cargar un archivo adjunto) Vea la imagen a continuación 1 Mi funcionalidad JavaScript del botón Enviar agrega el Li en el div perfectamente bien. Pero, cuando actualizo la página, desaparece.

 <input type="file" id="real-file" hidden="hidden" /> <button type="button" id="custom-button">CHOOSE A FILE</button> <span id="custom-text">No file chosen, yet.</span> <button type="button" id="submit-button" onclick="Submit()">Submit</button> <div id="collapseThree"> </div> <script> const realFileBtn = document.getElementById("real-file"); const customBtn = document.getElementById("custom-button"); const customTxt = document.getElementById("custom-text"); const submitBtn = document.getElementById("submit-button"); const slides = []; var str = ''; customBtn.addEventListener("click", function() { realFileBtn.click(); }); window.addEventListener('load', (event) => { console.log(slides) console.log('The page has fully loaded yo'); // document.getElementById("collapseThree").innerHTML }); /* window.onload = document.getElementById("slideContainer").innerHTML */ function Submit() { console.log("going in"); document.getElementById("collapseThree").innerHTML += str } realFileBtn.addEventListener("change", function() { if (realFileBtn.value) { customTxt.innerHTML = realFileBtn.value.match( /[\/\\]([\w\d\s\.\-\(\)]+)$/ )[1]; console.log(customTxt.innerHTML) slides.push(customTxt.innerHTML); slides.forEach(function(slide) { str = '<li><a href="/ec/Documents/' + slide + '">' + slide + '</a></li>'; }); console.log(arr) console.log(slides) } else { customTxt.innerHTML = "No file chosen, yet."; } }); </script>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar localStorage para guardar y leer datos. Simplemente llame

 function getSlides() { var slidesJson = localStorage.getItem('slides') || '[]'; return JSON.parse(slidesJson); }

para obtener todas las diapositivas actuales y

 function setSlides(slides) { localStorage.setItem('slides', JSON.stringify(slides)) }

para guardar el estado actual de la matriz.

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!