Estou tendo problemas na exibição dos dados de uma Orçamento já imputado no banco de dados. Ao acessar o detalhamento está exibindo o R$ NaN
nos campos de moeda.
Código de algumas funções:
orcamento.js
function sumTotal() {
var novo_total = 0;
$('#bodyOrcamento tr').each(function(index, element) {
if (!$(element).hasClass('etapa')) {
novo_total += Number($(element).children("td:nth-child(7)").html());
}
});
var custo_total = $('#custoTotal_orc');
custo_total.html(novo_total.toFixed(2));
}
function salvarOrcamento() {
var id = $("#codigo").val();
var descricao = $("#descricao_orc").html();
var empreendimento = $("#empreendimento_orc").data('id');
var custo = Number($("#custoTotal_orc").html());
}
O HTML
<table class="table hide table-bordered grid" id="tabelaOrcamento">
<thead>
<tr class="">
<th scope="col" title="Item">Item</th>
<th scope="col" title="Código">Código</th>
<th scope="col" title="Descrição">Descrição</th>
<th scope="col" title="Unidade">Unidade</th>
<th scope="col" title="Custo Unitário">Custo Unitário</th>
<th scope="col" title="Quantidade">Quantidade</th>
<th scope="col" title="Custo Total">Custo Total</th>
<th scope="col" title="Ações">Ações</th>
</tr>
</thead>
<tbody id="bodyOrcamento"></tbody>
</table>
<div class="pull-right">
<span style="font-size:15px;">Valor Total:</span><br>
<span style="font-size:30px;"><b>R$ <span id="custoTotal_orc">0.00</span></b></span>
</div>
td
de onde vc quer pegar o número? Apenas o número ou possui tags ou outra coisa que não seja o número?console.log($(element).children("td:nth-child(7)").html())
e veja se o retorno é um númeroint
oufloat
td
de onde vem o valor.