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

224
Views
Getting row information from click on a table cell

enter image description here

I'm trying to get the Flower Name and Location when a user clicks on the stars, so I can send the information to a database api endpoint.

I've tried getting the row information which works, but indexing into the row with cell[0] or cell[1] doesn't work.

let tr = star.parentElement.parentElement;
console.log(tr)

Console Output

  <tr class="odd">
    <td class="sorting_1">1</td>
    <td>flower</td>
    <td>Purple Roze Flower</td>
    <td>45</td>
    <td>3.5</td>
    <td>Ascend Montclair</td>
    ...
 </tr>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Indexing out of, then back into the element seemed to do the trick.

let tr = star.parentElement.parentElement;
let id = tr.children[0].innerHTML;
let product_name = tr.children[2].innerHTML;
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!