More styling added for table

This commit is contained in:
Lucas Patenaude
2024-04-14 17:30:20 -06:00
parent 2491c97a78
commit e4b44e05e3
5 changed files with 35 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
// script.js
document.addEventListener("DOMContentLoaded", function() {
var goalDifferenceCells = document.querySelectorAll("#standings-table tbody td:nth-child(8)"); // Selecting the cells in the goal_difference column
goalDifferenceCells.forEach(function(cell) {
var goalDifference = parseInt(cell.textContent);
if (goalDifference < 0) {
cell.style.color = "red"; // Change text color to red for negative goal difference
} else if (goalDifference > 0) {
cell.style.color = "green"; // Change text color to green for positive goal difference
} // If goal difference is 0, leave text color unchanged
});
});