JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<table>
<tr>
<td>Hello there</td>
<td id="HDD">I want to know this cell's color</td>
</tr>
</table>
</body>
CSS
TD {
TEXT-ALIGN: CENTER;
BORDER: 2PX SOLID BLACK;
BORDER-COLLAPSE: COLLAPSE;
BACKGROUND-COLOR: #D0A9F5;
}
TABLE{
BORDER-COLLAPSE: COLLAPSE;
}
}
JavaScript
//var myColor= document.getElementById("HDD").style.background="#D0A9F5"
//var myColor = document.getElementById("HDD").style.backgroundColor;
var Color = document.getElementById("HDD");
var myColor = window.getComputedStyle(Color,null).getPropertyValue('background-Color');
alert(myColor);