JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <td height='40' bgcolor="#ff0000" colspan=4 align='center' id = 'Bac11'  >Réserve</td>
    </tr>
</table>

JavaScript

function getStyle(el,styleProp)
{
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function foo(elt){
alert( getStyle(elt,"background-color"));
}

$(function(){
    $('#Bac11').on('click',function(){ foo($(this).attr('id'));})
})