showing results for - "javascript change table row color based on value"
Diego
08 Mar 2020
1var rows = document.getElementById("trans_separate").getElementsByTagName("tbody")
2  [0].getElementsByTagName("tr");
3
4    // loops through each row
5    for (i = 0; i < rows.length; i++) {cells = rows[i].getElementsByTagName('td');
6
7            if (cells[0].innerHTML == 'R')
8                rows[i].className = "red";
9
10            if (cells[0].innerHTML == 'Y')
11                rows[i].className = "yellow";           
12 }
13