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

392
Views
How to map specific HTML table columns and get its data into an array (JS)?

I'm trying to get the table data from some columns and I've tried a couple of variations I could think of, but none worked:

function updateAllTasks() {
var table = document.getElementById("dtable");

var [, ...tr] = table.querySelectorAll("tr");
var tableData = [...tr].map(r => {
var td = r.querySelectorAll("td");
    console.log([...td].map(c => c[0].innerHTML, c[1].innerHTML, c[8].querySelectorAll('input[name="rowcheckbox"]')[0].value)); //This is the one giving me error ReferenceError: c is not defined
})
console.log(JSON.stringify(tableData));
}

Thanks for your help!

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

0

As mentioned by Andy, following data structures logic. The best approach for this case will be to call the data inside of an Array, and after that, build the table with the data.

This will provide more flexibility the moment you process the information.

Reference

  • Javascript Array
  • Arrays in Apps Script
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!