adding two variables together
Posted
by James Trusler
on Stack Overflow
See other posts from Stack Overflow
or by James Trusler
Published on 2010-06-07T21:07:14Z
Indexed on
2010/06/07
21:12 UTC
Read the original article
Hit count: 208
I have been trying for... about 4 hours now lmao.
currentCalc returns 50 currentSum returns 0 when i alert them. Yet I cannot add them together with parseInt????
what am i doing wrong :'(
var identRow = $('tr.identRow');
identRow.each(
function(){
var getIdentClass = $(this).attr('class').split(' ').slice(1);
$('tr.ohp' + getIdentClass + ' td.EURm').each(
function(index){
var currentCalc = parseInt($(this).text().replace('.',''), 10);
var currentSum = $('tr.' + getIdentClass + ' td.totalEURm', this).text().replace('.','');
total = parseInt(currentCalc, 10) + parseInt(currentSum, 10);
$('tr.' + getIdentClass + ' td.totalEURm').text(total);
if (index==6){
alert(total);
}
}
);
}
);
© Stack Overflow or respective owner