I'm working on writing a script that works on RnR Caption Hits. I'd like to be able to use the tab key and scroll down the page from document box to document box. Or, would it be easier to tab/scroll from one "upper" radio to the next "upper" radio button? Code: $(document).keyup(function(event) { if(event.which == 9) { console.log(event); } });
Use a counter to keep track of what document box you want to scroll to the next one. Code: let i = 0; const docbox = document.getElementsByClassName(`documentbox`); document.addEventListener(`keydown`, function (event) { const key = event.key; if (key === `Tab`) { if (docbox[++ i]) docbox[i].scrollIntoView(); } });