Sorry for my code, i am new to javascript and didn't figure out what's going on. My scenario is if there is Group Discount available then I want to use grpDis as a OurCost otherwise I want to use OrgCost as a OurCost.
OrgCost is available on every pages but grpDis only available where group discount is available.
Thank you for the help.
var OrgCost = '<?=$ourCost;?>';
var grpDis = document.getElementById('cost1').innerHTML;
var OurCost;
if (typeof grpDis!=='undifined') {
OurCost = parseInt(changeNumber(grpDis));
} else {
OurCost = parseInt(changeNumber(OrgCost));
}
conslole.log(OurCost);