I have a select with lots of parcels, and would like to add the rows in the table dynamically with the amount of parcels 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><buttonid="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 about 2 hours and have made so many adjustments that I can not think of a solution.