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

126
Views
Cómo reemplazar cada valor que ya está almacenado en una matriz JQUERY

¿Puedo saber cómo puedo reemplazar cada valor DOM que ya está almacenado en una matriz?

 $(document).ready(function() { $(".compare-filter-item").click(function() { var column_value = $(this).attr("data-column"); var selected_data_product = $(this).attr("data-product"); var myarray = []; $(".compare-all .compare-products [data-product='" + selected_data_product + "']").each(function(index, value) { var value = $(this).html(); myarray[index] = value; }); $(".compare-main .compare-products [data-column='" + column_value + "']").each(function(index, value) { // I WANT TO REPLACE EACH OF THE VALUE HERE WITH THE ONES STORED IN ARRAY }); }); });

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

0

Como esto

 $(function() { $(".compare-filter-item").on("click",function() { const column_value = $(this).attr("data-column"); const selected_data_product = $(this).attr("data-product"); const myarray = $(`.compare-all .compare-products [data-product="${selected_data_product}"]`).map(function() { return $(this).html(); }); $(`.compare-main .compare-products [data-column="${column_value}"]`) .each(function(i) { $(this).html(myarray[i]) }); }); });

o incluso esto si hay una relación de uno a uno

 $(function() { $(".compare-filter-item").on("click",function() { const column_value = $(this).attr("data-column"); const selected_data_product = $(this).attr("data-product"); const $myarray = $(`.compare-all .compare-products [data-product="${selected_data_product}"]`); $(`.compare-main .compare-products [data-column="${column_value}"]`) .each(function(i) { $(this).html(myarray[i].html()) }); }); });
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!