To begin with :focus used for input form fields, I doubt that it can be applied to any other elements. You should use your own class:
JS:
$('td').click(function (event) { $('*').removeClass('focus'); $(this).addClass('focus'); });
CSS
td.focus { background-color:Blue; }
Thus, focusing a td will defocus everything that the .focus class can have, and then set it to the selected element.
You can also do:
$('*').click(function(event){ $(this).removeClass('focus'); }); $('td').click(function (event) { $(this).addClass('focus'); });
Thus, clicking on something will turn off td focusing (similar behavior with respect to how: focus works on input fields or how: active works on anchor tags)
source share