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

143
Views
Cómo encontrar elementos de html con jQuery

Tengo una tabla con opción de casilla de verificación para cada fila.

Para cada fila tengo href (enlace dedicado) manejado por archivo HTML.

He creado un botón llamado: "descargar" por JS, y quiero definir este botón para guardar todos los enlaces de las filas que se han seleccionado en las casillas de verificación y guardarlo en una variable, enlaces seleccionados = []

¿Alguna idea de cómo puedo arreglar mi función JS?

 //function download button $(document).on("click", "#downloadBtn", function() { console.log("download button click") var selectedLinks = [] $('.last') .checkSingel("checkSingle") .forEach(function(record) { if (record.checked) { //selectedLinks.push(record.href) alert($(this).attr("href")); } }) console.log(selectedLinks) });
 </td> <td class="last"><a style="font-weight:bold;text-decoration:underline;" href="/download/{{ elements.EvidencePath }}">Click here to download Evidence</a> </td>

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

0

este es el codigo correcto:

 // function to add multiple check box for all rows $(document).on("click", ".checkAll", function(){ $('input:checkbox').not(this).prop('checked', this.checked); // this statement is checked it will enable the download button ( for check all button) if(this.checked) { $(".dt-buttons a:last-child").removeAttr("disabled"); }else { $(".dt-buttons a:last-child").attr("disabled", "disabled"); } }); // this statement is checked to eanbled the button if the checkbox checked. ( for check single button) $(document).on("click", ".checkSingle", function(){ if(this.checked) { $(".dt-buttons a:last-child").removeAttr("disabled"); }else { $(".dt-buttons a:last-child").attr("disabled", "disabled"); } }); //function download button $(document).on("click", "#downloadBtn", function(){ console.log("download button click") var selectedLinks = [] $('.last').checkSingel("checkSingle").forEach(function(record){ if (record.checked){ //selectedLinks.push(record.href) alert($(this).attr("href")); } }) console.log(selectedLinks) });

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!