0
I have a form with fields in array
<tr>
<td><input id="item" name="item[]" type="text" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->item }}"></td>
<td><input id="descricao" name="descricao[]" type="text" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->descricao }}"></td>
<td><input id="quantidade" name="quantidade[]" type="number" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->quantidade }}"></td>
<td><input id="valor_unitario" name="valor_unitario[]" type="text" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->valor_unitario }}"></td>
<td><input id="desconto" name="desconto[]" type="text" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->desconto }}"></td>
<td><input id="total" name="total[]" type="text" class="form-control form-control-sm" aria-required="true" aria-invalid="false" value="{{ $servico->quantidade * $servico->valor_unitario - $servico->desconto }}" readonly></td>
<td><a onclick="RemoveTableRowOrcamento(this)" id="delete" class="delete"><i class="fa fa-trash"></i></a></td>
</tr>
and this script
$(function() {
$("#valor_unitario").maskMoney();
$("#desconto").maskMoney();
});
but Mask only works in the first two inputs.. value and discount, then it doesn’t work but in the next ones of the array.
Dear Micheal, Ids cannot repeat themselves, every TR you are probably repeating Ids
– Guilherme Nascimento
Michael, if you have already obtained the answer, close this question by stating the answer.
– André Lins