JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr><td>Test</td></tr>
</table>
<button>Overlay</button>

CSS

table {
    background-color: white;
    height: 300px;
    width: 300px;
}

.overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: black;
    opacity: 0.5;
	z-index: 50;
}

JavaScript

$('button').click(function() {
		$('body').append("<div class='overlay'></div>");
        $('table').css('zIndex', '60');
        $('table').css({ zIndex: 60 });
});