I am currently creating a grade management system and i need your help with a forEach function.
This is my code and i am trying to change the color based on the grade. As you may guessed it's not working. The error that i get is gradeid.forEach is not a function
let gradeid = document.querySelector(".gradeid");
console.log(gradeid);
gradeid.forEach(function() {
if ({{grades.0.grade}} >= 5) {
gradeid.style.color = "#00d629";
}
else if ({{grades.0.grade}} < 5 && {{grades.0.grade}} >= 4) {
gradeid.style.color = "#ffce00";
} else {
gradeid.style.color = "#D50000";
}
});
Thank you for helping
PS: Dedadline is tomorrow
I tried a lot but failed.