Please note that this is not a knockout specific problem. The problem is with the way elements handle keyup/down/press events.
A table
(or tr
, td
) by default cannot be given focus. However, you can change that by adding a tabindex
attribute:
<tr tabindex="0" id="example"></tr>
You can then give the tr
focus, and also blur it with the hover
event:
$("#example").hover(function() {
this.focus();
}, function() {
this.blur();
}).keydown(function(e) {
alert(e.keyCode);
});
When the tr
has focus, it will accept keyboard events. Look at a sample here.