I would like to display the total value and not NAN ...
function sumQuantity() {
var elements = document.getElementsByClassName('itemTable');
var sum = 0;
for (i = 0; i < elements.length; i++) {
sum = sum + parseFloat(elements[i].innerHTML);
};
alert(sum);
}
sumQuantity();
<table class="itemTable" cellspacing="0" rules="all" border="1" id="OrdersDataGrid" style="border-collapse:collapse;margin-right:10px;">
<tbody>
<tr style="background-color:#E8E8E8;">
<td class="itemTableHeader itemTableHeader-Id">Pedido</td>
<td class="itemTableHeader itemTableHeader-Date">Criado</td>
<td class="itemTableHeader itemTableHeader-Items">Itens</td>
<td class="itemTableHeader itemTableHeader-Proof">Prova</td>
<td class="itemTableHeader itemTableHeader-Price">Preço total</td>
<td class="itemTableHeader itemTableHeader-Status">Status</td>
<td class="itemTableHeader itemTableHeader-Options">Opções</td>
</tr>
<tr class="48 G-CDC2B78C">
<td class="itemTable itemTable-Id">G‑CDC2B78C</td>
<td class="itemTable itemTable-Date">23/03/2018 12:00</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl03_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl03$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="46 G-CDB4B78C">
<td class="itemTable itemTable-Id">G‑CDB4B78C</td>
<td class="itemTable itemTable-Date">23/03/2018 11:56</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl04_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl04$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="33 G-CDB7B78D">
<td class="itemTable itemTable-Id">G‑CDB7B78D</td>
<td class="itemTable itemTable-Date">21/03/2018 17:29</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl05_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl05$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="27 G-CDB3B78E">
<td class="itemTable itemTable-Id">G‑CDB3B78E</td>
<td class="itemTable itemTable-Date">21/03/2018 15:28</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 011 – Cupom Bio Running 50% de desconto</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 78,00</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl06_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl06$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="22 G-CDB8B78E">
<td class="itemTable itemTable-Id">G‑CDB8B78E</td>
<td class="itemTable itemTable-Date">21/03/2018 12:07</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 012 – Flyer BioNurtri Divulgação</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 33,00</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl07_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl07$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="16 G-CDB4B78F">
<td class="itemTable itemTable-Id">G‑CDB4B78F</td>
<td class="itemTable itemTable-Date">20/03/2018 17:52</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 003 – CARTÃO DE VISITA BIORITMO SMARTFIT FITNESSCHANNEL</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl08_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl08$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="13 G-CDB7B78F">
<td class="itemTable itemTable-Id">G‑CDB7B78F</td>
<td class="itemTable itemTable-Date">20/03/2018 17:23</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 002 – CARTÃO DE VISITA BIORITMO SMARTFIT</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl09_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl09$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="9 G-CDCAB797">
<td class="itemTable itemTable-Id">G‑CDCAB797</td>
<td class="itemTable itemTable-Date">20/03/2018 17:00</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl10_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl10$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="6 G-CDCAB78A">
<td class="itemTable itemTable-Id">G‑CDCAB78A</td>
<td class="itemTable itemTable-Date">20/03/2018 16:49</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl11_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl11$Linkbutton3','')">Detalhes</a>
</td>
</tr>
<tr class="4 G-CDCAB78C">
<td class="itemTable itemTable-Id">G‑CDCAB78C</td>
<td class="itemTable itemTable-Date">20/03/2018 16:48</td>
<td class="itemTable itemTable-Items">
<p class="itemTableLabelWithIcon"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> 001 – CARTÃO DE VISITA BIORITMO</p>
</td>
<td class="itemTable itemTable-Proof">
<p class="proofLinks"><img align="absmiddle" width="18px" height="18px" src="Images/space.gif"> </p>
</td>
<td class="itemTable itemTable-Price">R$ 35,50</td>
<td class="itemTable itemTable-Status"><img align="absmiddle" src="Images/OrderInProcessStatusIcon.png"> Em processo</td>
<td class="itemTable itemTable-Options">
<a id="OrdersDataGrid_ctl12_Linkbutton3" class="siteLink" name="Linkbutton1" href="javascript:__doPostBack('OrdersDataGrid$ctl12$Linkbutton3','')">Detalhes</a>
</td>
</tr>
</tbody>
</table>