I have a simple data-table being sourced from an Oracle DB. There is a column whereas each cell contains only one character - "R","Y", or "N".
The logic is focused on the correct column because I used the "alert(cell[14].innerText); to see my returned values in the browser.
The issue is when I try to apply a color change on the row background color based on the cell value of either R,Y or N nothing happens...? Here is my code so far, any help would be much appreciated.
Expand|Select|Wrap|Line Numbers
- var rows = document.getElementById("trans_separate").getElementsByTagName("tbody")[0].getElementsByTagName("tr");
- //alert(rows.length);
- for (i = 0; i < rows.length; i++) {
- cells = rows[i].getElementsByTagName('td');
- if (cells[14].textContent === 'R') rows[i].className = "red";
- else if (cells[14].textContent === 'Y') rows[i].className = "yellow";
- else if (cells[14].textContent === 'N') rows[i].className = "green";
- }