How to add background color + border dynamically to keep together

Hi @jan.zitniak

I think the better option is used classList - https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

Then we don’t have a problem with an add another class to element (cell).

Here is an updated demo - https://jsfiddle.net/qtvduL21/