Question

I am using this code to add a row to a table usign js:

var tbody = document.getElementById('tableID').getElementsByTagName('tbody')[0];

var row = document.createElement("TR");
tbody.appendChild(row);

I want to use onmouseover on that TR to make it change the background color, how can I do that?

Was it helpful?

Solution

row.onmouseover = function() { this.style.backgroundColor = "Green"; };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top