I'm having trouble capturing keydown events using the jQuery DataTable. My goal is to allow users to navigate through the rows of the table using the arrow keys. So I would like to catch keydown events and move the selected row of the table (this is what I track outside the data using the class for the selected row) when the user presses the arrow key. However, I do not seem to catch the keydown events.
For example, the code below does not work:
$('#myTable tbody').keydown(function (event){...});
My thought is that the problem in the table has no focus, but maybe this is the wrong way. For example, even if I add the following, I will not catch keydown events with the above code:
$('#myTable tbody').click(function(e){ $('#myTable tbody').focus();});
I can catch keydown with $ (document), but this is not desirable.
Thank.