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

123
Views
El ID de objeto en la fila duplica la primera fila

Estoy tratando de agregar una nueva fila con una ID de objeto diferente. Aquí está el código:

 function addRows(){ var table = document.getElementById('emptbl'); var rowCount = table.rows.length; var cellCount = table.rows[0].cells.length; var row = table.insertRow(rowCount); for(var i =0; i <= cellCount; i++){ var cell = 'cell'+i; cell = row.insertCell(i); var copycel = document.getElementById('col'+i).innerHTML; cell.innerHTML=copycel; var inp1 = cell.getElementsByClassName('select')[0]; console.log(' test ',JSON.stringify(inp1)); if(i > 1) { $('select[name="product_id0"]').attr('name', 'product_id'+ (i).toString()); $('select[name="product_id0"]').attr('id', 'product_id'+ (i).toString()); $('select[name="product_id0"]').attr('class', 'product_id'+ (i).toString()); } if(i == 11){ break; } } } function deleteRows(){ var table = document.getElementById('emptbl'); var rowCount = table.rows.length; if(rowCount > '2'){ var row = table.deleteRow(rowCount-1); rowCount--; } else{ alert('There should be atleast one row'); } } function getComboA(selectObject) { console.log('test'); }

Cuando presiono el botón Agregar fila, agrega una nueva fila pero la ID del objeto duplica la ID del objeto de la primera fila. ¿Hay alguna solución?

about 4 years ago · Juan Pablo Isaza
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!