I have a table in HTML with twitter bootstraps.
When I click on the table javascript get an id and fills a Modal with information. Something like this:
$('.table > tbody > tr').click(function() {
//lots of things happens
});
<div class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<!-- lots of information loaded with AJAX --->
</div>
</div>
</div>
This works fine, however I want to be able not only to click, but to navigate with buttons (pressing down key would go down and pressing up key would a row up).
Any suggestions would be appreciated.
2
Answers
You would capture the key inputs on the whole document and modify what you need at will, here is a basic template for the arrow keys. If you need other keys here is a useful site to get them http://keycode.info/
First you need to wrap your code with function and call it from your click handler:
Then, you can make handler for “keydown” event: