I've been trying to apply a styling condition using an if statement in my jQuery code based on the result from an API, but for some reason, I'm not seeing the color change. I have given an ID to try and change the color through CSS.
$.getJSON(API2, function (result) {
console.log(result);
for (i = 0; i < result.length; i++) {
var tabledata = `
<tbody>
<tr>
<th scope="row">`+ result[i].Season + `</th>
<td><p class="td-item">`+ result[i].DateTime + `</p></td>
<td><p class="td-item">`+ result[i].Name + `</td>
<td><p class="td-item" class="stat">`+ result[i].Status + `</p></td>
</tr>
`;
var stat = result[i].Status;
$(".event").append(tabledata);
}
if (stat == "final") {
$(".td-stat").attr('id', 'td-stat');
console.log(stat);
}
});