I have a table (shown below) where each cell has a checkbox that is hidden until the user goes over that cell. If the checkbox is selected, it will be displayed when the mouse leaves the cell, otherwise the flag will be hidden again.

The problem is that I don’t know how to check the box for the individual cell that the user is currently soaring. At the same moment, a mouse over any cell will show each flag:

My idea of where the cells are installed:
@for (int i = 0; i < Model.Users.Count(); i++) {
<tr>
@for (int j = 0; j < Model.Users.Count(); j++) {
string background = Model.AssignedArray[i] == j ? "background-color:#157fa0" : null;
string text = Model.AssignedArray[i] == j ? "color:#ffffff" : null;
<td class="tableCell" style="text-align: center; @background; @text">
@Model.Matrix[i, j]
<input type="checkbox" class="hideCheckBox" name="forcedAssigned" value="">
</td>
}
</tr>
JavaScript for checkboxes:
<script>
$('.tableCell')
.mouseenter(function () {
$(".hideCheckBox").show();
})
.mouseleave(function () {
if ($(".hideCheckBox").is(":checked"))
$(".hideCheckBox").show();
else
$(".hideCheckBox").hide();
});
</script>
CSS
.hideCheckBox {
display: none;
}
My script is wrong, but I don’t know how to fix work with individual cells.