1
I have a select with amount of plots, and would like to add the rows in the table dynamically with the amount of plots selected. example:
$('#simular').click(function(){
$('#table').show();
var parcelas = 4; //simulando 4 parcelas
var total = 4750.00; //simulando este valor
var table;
var x = 1;
while(x <= parcelas){
table += '<tr><td> de </td>';
table += '<td>data</td>';
table += '<td>$valor</td></tr>';
//$('#table tbody').prepend(table); comentei o código pois está dando timeout
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="simular">Simular</button>
<table id="table" style="display:none;">
<tr>
<th>parcela</th>
<th>valor</th>
</tr>
<tbody>
</tbody>
</table>
I’ve been standing here for a couple of hours and I’ve made so many adjustments I can’t think of a solution.
I made a primary mistake, thank you for your help.
– WMomesso
@Wagnerfernandomo anything, I’m glad I helped.
– Sergio