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

167
Views
El botón de carga no responde después de la primera iteración JQUERY

Tengo un botón que carga el archivo de Excel.

 <input type="file" id="input-excel" value="Choose File" accept=".xlsx" />

A continuación se muestra un script incrustado en el HTML para leer el archivo de Excel y mostrarlo en la interfaz de usuario.

 <script type="text/javascript"> // read and display the records from excel file on the screen // passing in my button id here $('#input-excel').change(function (e) { var reader = new FileReader(); reader.readAsArrayBuffer(e.target.files[0]); reader.onload = function (e) { var excelData = new Uint8Array(reader.result); var wb = XLSX.read(excelData, { type: 'array' }); console.log(wb); var htmlstr = XLSX.write(wb, {/* sheet: "Sheet1",*/ type: 'binary', bookType: 'html'}); $('#wrapper')[0].innerHTML += htmlstr; }; }); </script> @section scripts{ <script src="~/Scripts/ViewModels/RmaCreation/rmacreation.js"></script> <script src="~/Scripts/knockout-3.2.0.js"></script> <script language="javascript" src="~/Scripts/xlsx.full.min.js"></script> }

Puedo cargar un archivo de Excel en la primera iteración. Puedo ver los registros del archivo de Excel en la interfaz de usuario.

Sin embargo, el botón deja de responder en la segunda iteración. ¿Cómo hago que este botón responda después de cada iteración?

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

0

https://jsfiddle.net/03ut9zjs/2/

 <input type="file" id="input-excel" value="Choose File" accept=".xlsx" /> <div id="wrapper"> </div>
 // read and display the records from excel file on the screen // passing in my button id here $('#input-excel').change(function (e) { $('#wrapper')[0].innerHTML =""; var reader = new FileReader(); reader.readAsArrayBuffer(e.target.files[0]); reader.onload = function (e) { var excelData = new Uint8Array(reader.result); var wb = XLSX.read(excelData, { type: 'array' }); console.log(wb); var htmlstr = XLSX.write(wb, {/* sheet: "Sheet1",*/ type: 'binary', bookType: 'html'}); $('#wrapper')[0].innerHTML += htmlstr; }; });

No ha incluido el contenedor div en su código, por lo que no estoy seguro de dónde/cómo lo ha colocado.

Parece funcionar bien en este violín. ¿Puedes recrear el problema aquí?

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!