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

160
Views
Adding table data element identifier in JS

I need to create an edit button for each data cell in the column and I saw in this tutorial that to start things of I need to add an identifier to the Table Data Cell element ( ): https://www.youtube.com/watch?v=pNxWUfw1J_w, but I have those tds defined in JS:

function refresh_row(row, values) {
  var tds = $(row).children('td');
  var ii = 0;

  $(tds[ii]).html(values.type.name);
  ii++;
  $(tds[ii]).html(values.description);
  ii++;
  $(tds[ii]).html(values.company);
  ii++;
  $(tds[ii]).html(values.place);
  ii++;
}

Is there any way to add an identifier like:

id="result-${obj.id}" data-testid="${obj.id}""

to the values.description data cell elements?

If it makes it any easier, values is a Python dictionary populated with JSON data similar to the one used in this question: Is transferring JSON data in Django possible without JS / JQuery?

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

0

You could use attr('id'...) and data('testid'...) to achieve this:

  $(tds[ii]).html(values.description).attr('id', 'result-${obj.id}').data('testid', '${obj.id}')
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!