Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda