3
I’m looking for a td
with jQuery.
var linhaTr = $("tbody").find("tr:first-child");
var tamanhoTd = linhaTr.find("td:nth-child(2)").text();
and he returns me for example R$ 5,00
. But I need to get back to make calculations the value 5.00
. Take out the R$ and change the comma per point...
Moreover...
I wonder if it is "Regular Expressions" that I need to capture the text in a special way, getting only a few things, I need to study this and do not know the name right.
pop
can be more elegant than accessing the index in this case :p– BrTkCa
I would recommend using regex also in the point replace, because if it is a number in the millions the replace does not take all occurrences of the point. Thus: parteNumerica.replace(/./g, '). replace(',', '.'), would be sure that all point occurrences in the number would be removed
– Gabriel Weber
It didn’t work, the result is Nan
– Bruno Cabral
@Brunocabral I fixed, there was a bug. If it doesn’t tell you what the string you’re using.
– Sergio
@Gabrielweber well seen! corrected :)
– Sergio