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

105
Views
Transfer variables between tables

On my html I have multiple tables, which are for different valuations. The results of those valuations are supposed to be in another table. The text of valuation_all in the tables.taglist should be transferred into another table. I'm really lost here. Newby with this topic so I'll appreciate every help!

Table for summary results

<table id="results" class="summary">
  <th>Test</th>
  <th>result</th>
  <tr>
    <td>E-01</td>
    <td>text</td>
  </tr>
  <tr>
    <td>E-02</td>
    <td>text</td>
  </tr>
</table>

Tables of valuation

<p>
  <table id="results1" class="taglist">
    <th>Name</th>
    <th>result</th>
    <tr>
      <td class="valuation">FAIL</td>
      <td rowspan=2 class="valuation_all">FAIL</td>
    </tr>
    <tr>
      <td class="valuation">PASS</td>
    </tr>
  </table>
</p>

<p>
  <table id="results2" class="taglist">
    <th>Name</th>
    <th>result</th>
    <tr>
      <td class="valuation">x</td>
      <td class="valuation_all" rowspan=2>OPEN</td>
    </tr>
    <tr>
      <td class="valuation">x</td>
    </tr>
  </table>
</p>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Assuming your results list tables are ordered the same way you ordered rows in your global results table, you can perform a forEach on all .valuation_all, and then mirror each text on the global results table:

const resTables = document.querySelectorAll('.valuation_all')
const results = document.querySelectorAll('#results tr > td + td')

resTables.forEach( function(el, i) {
  results[i].textContent = el.textContent
})
<table id="results" class="summary">
  <tr>
    <th>Test</th><th>result</th>
  </tr>
  <tr>
      <td>E-01</td><td>text</td>
  </tr>
  <tr>
      <td>E-02</td><td>text</td>
  </tr>
</table>

<hr>

<table id="results1" class="taglist">
  <tr>
    <th>Name</th><th>result</th>
  </tr>
  <tr>
      <td class="valuation">FAIL</td><td rowspan="2" class="valuation_all">FAIL</td>
  </tr>
  <tr>
      <td class="valuation">PASS</td>
  </tr>
</table>

<table id="results2" class="taglist">
  <tr>
    <th>Name</th><th>result</th>
  </tr>
  <tr>
      <td class="valuation">x</td><td class="valuation_all" rowspan="2">OPEN</td>
  </tr>
  <tr>
      <td class="valuation">x</td>
  </tr>
</table>

Please consider using data attributes for better matching. https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

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!