This is my object:
var testing = {
"total": {
"q1": "10,000€",
"q2": "20,000€",
"q3": "19,000€",
"q4": "210,000€"
},
"new": {
"q1": "10,000€",
"q2": "20,000€",
"q3": "19,000€",
"q4": "210,000€"
},
"renewal": {
"q1": "10,000€",
"q2": "20,000€",
"q3": "19,000€",
"q4": "210,000€"
}
}
I want to loop through the data associated specifically with "total", I'm not sure how to specifically get the values from "total"
. The following doesn't work :(
$.each(testing, function(i, item) {
$("#kpi-table").find('tr.total td').each(function (i, el) {
$(this).html(item[0].[i]);
});
});
HTML
<table id="kpi-table" class="table table-striped">
<thead>
<th></th>
<th>Q1</th>
<th>Q2</th>
<th>Q3</th>
<th>Q4</th>
<th>Month</th>
</thead>
<tbody>
<tr class="total">
<td>Total</td>
<td class="q1"></td>
<td class="q2"></td>
<td class="q3"></td>
<td class="q4"></td>
<td></td>
</tr>
..