• We just upgraded the platform on which this website runs! Please inform @Jaxel of any issues.

How Can You Add Score Fields?

ProTableTop

New member
I was wondering if there is a way to add score fields. Basically what I am trying to do is take these and add them together.

$('#Primary_1s').text(docData['Primary_1s']);
$('#Player_Secondary_1s').text(docData['Player_Secondary_1s']);
$('#Player_Secondary_2s').text(docData['Player_Secondary_2s']);
$('#Player_Secondary_3s').text(docData['Player_Secondary_3s']);

Once added to then equal
$('#Player_VP_1s').text(docData['Player_VP_1s']);

Any help would be amazing!
 

ProTableTop

New member
Figured this out if anyone else needs it.

var vp1 = parseInt(docData2['Primary_1s']) + parseInt(docData2['Player_Secondary_1s']) + parseInt(docData2['Player_Secondary_2s']) + parseInt(docData2['Player_Secondary_3s']);
docData['Player_VP_1s'] = vp1;
$('#Player_VP_1s').text(docData['Player_VP_1s']);
 

Jaxel

Administrator
Ah yes. Welcome to JavaScript. All variables are received as strings, unless specifically told to be calculated as an integer.