4
I need to get the values of each row of my table. My table has no fixed number of rows or columns.
I only desire the values of inputs
(within the td
). Desired inputs have class quantidadeDigitada
The ideal would be to create an array of values per line. For example:
Valores[0] = 20.40;
Valores[1] = 20.40;
Valores[2] = 20.40;
Because I need to get the data as follows:
Valores.toString() = 20.40,20.40,20.40;
With this I can identify the quantity per product based on the position of the array
The only problem is that my table has relative columns because it is generated dynamically portando can not make a note to
.find("input:eq(0)")
. I would need to traverse a line and add to each instance of the array the values of that line separated by the character "."– Rafael Barbosa
@Rafaelbarbosa So it’s N columns per row, right? It would work a
$(this).find("input").map(function() { return this.value }).toArray().join('.')
? (the same strategy used for rows, repeated for columns)– mgibsonbr
It worked as follows: $('.quantityDigited') . Closest("tr") . map(Function () { Return $(this).find(".quantityDigited").map(Function () { Return this.value }).toArray().Join('.') }) . toArray() . Join(',') );
– Rafael Barbosa