I have nested two for loops like below. But the inner loop stops the outer loop in the first occurence. On execution,the below code gives only my 13th row in grey color where the expected behaviour is to see the 13th,14th and 15th row in grey color.
var rows = document.getElementsByTagName("tr");
for(var i = 0, max = rows.length;i < max; i++)
{
var cells = rows[i].getElementsByTagName("td");
if (rows[i].cells[4].innerHTML == "Asset Removed")
{
for(var inner = 0, max = rows[inner].cells.length;inner < max; inner++)
{
cells[inner].style.backgroundColor = "grey";
}
}
}
Any ideas?
maxin the inner loop to something else.