Is there any way to clone an element in JQuery
but that the clone has a different id?
That is, I have a table and each box has its own id, if I wanted to add a new row with a similar appearance but its boxes had another id, is that possible?
<table id="Tabla-Rutinas">
<tr> <!-- Fila1 -->
<td colspan="6" id="Casilla-1-1"></td>
</tr>
<tr> <!-- Fila2 -->
<td id="Casilla-2-1">Nombre</td>
<td id="Casilla-2-2">Herramienta</td>
<td id="Casilla-2-3">Series</td>
<td id="Casilla-2-4">Repeticiones</td>
<td id="Casilla-2-5">Peso propuesto</td>
<td id="Casilla-2-6">Peso final</td>
</tr>
<tr> <!-- Fila3 -->
<td colspan="6" id="Casilla-3-1"></td>
</tr>
<tr> <!-- Fila4 -->
<td id="Casilla-4-1"></td>
<td id="Casilla-4-2"></td>
<td id="Casilla-4-3"></td>
<td id="Casilla-4-4"></td>
<td id="Casilla-4-5"></td>
<td id="Casilla-4-6"></td>
</tr>
</table>
That is, I want that table to be expandable, and I put a series of buttons depending on whether I want to add a new row like 3 (which is a single box) or a new row like 4 (which is 6) boxes).
So, if I want to click on a button, add a new row 4, but let the id of each box be, Box-5-1, Box 5-2, Box-5-3, etc.
How could it be done?