I have a table that is styled based on cell content. Cell contents are limited to specific data so I created an array. I can style the cell if I reference an index of the array:
var greencell = ["item1", "item2", etc]
var cells = document.getElementById("mytable").getElementsByTagName("td");
for (var i = 0; i < cells.length; i++) {
if (cells[i].innerHTML == greencell[0]) {
cells[i].style.backgroundColor = "#80ff80";
}
}
However, I need to access the entire array. When I set comparison == greencell the styling is not applied. What am I missing? Am I even approaching this correctly? Loop through the array similar to the cells loop and set comparison on the loop result? My mind is mush at the moment
Thanks!