Issue
everything was going well until I had two problems with jquery, and this is the second.
I have this javascript code, inside a function, that creates "tr" elements and then through a for it adds them to a table already created in html.
for(let i = 1; i <= plazos; i++) {
pagosIntereses = parseFloat(valor*(tasas/100));
pagoAmortizacion = pagoMensual - pagosIntereses;
valor = parseFloat(valor-pagoAmortizacion);
fechaX = hoy.setMonth(hoy.getMonth() + 1);
//creacion de las filas
const fila = document.createElement("tr");
fila.innerHTML =
` <td>${formatoFecha(fechaX)}
<td class="valorCuota">${pagoMensual.toFixed(2)}</td>
<td>${pagoAmortizacion.toFixed(2)}</td>
<td>${pagosIntereses.toFixed(2)}</td>
<td>${valor.toFixed(2)}</td>`;
datosTabla.appendChild(fila);
}
Now I try to pass it to Jquery and I can't make it work, I tried to do the following which was what I logically came up with, but I couldn't
const fila = $("tr").append(
`<td>${formatoFecha(fechaX)}
<td class="valorCuota">${pagoMensual.toFixed(2)}</td>
<td>${pagoAmortizacion.toFixed(2)}</td>
<td>${pagosIntereses.toFixed(2)}</td>
<td>${valor.toFixed(2)}</td>`);
datosTabla.appendChild(fila);
Solution
I appreciate all of your responses! They have helped me to reach this solution.
$("#tablaBody").append(`<tr><td>${formatoFecha(fechaX)}
<td class="valorCuota">${pagoMensual.toFixed(2)}</td>
<td>${pagoAmortizacion.toFixed(2)}</td>
<td>${pagosIntereses.toFixed(2)}</td>
<td>${valor.toFixed(2)}</td>`);
I thank you very much
Answered By - user16754567 Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.