I have the following code:
<td>
<input type="text" name="listPeso[]" class="input_next autoNumeric" data-v-min="0.000" data-v-max="999999999999999999999.999" data-a-sep="" data-a-dec="." onkeyup="runScript(event,this)">
</td>
Which are increased as needed by the user, so I would have N
tags with the name of listPeso[]
, which I must add to show the total weight.
The problem is:
I do not know how to traverse them with javascript or with JQuery.
Try something like:
var dom=document.getElementsByName("listPeso[]");
console.log(dom);
To obtain the data, but they are empty, also try with:
$("input[name='listPeso[]']").each(function(indice, elemento) {
console.log('El elemento con el índice '+indice+' contiene '+$(elemento).text());
});
But I do not get results.