I have a page with a few containers. How to give focus to one of them on page load, so that the user can use arrow keys to scroll (or even
containers. How to give focus to one of them on page load, so that the user can use arrow keys to scroll (or even
How to give focus to one of them on page load, so that the user can use arrow keys to scroll (or even
Focus events are used for input elements. Use click event instead:
click
document.querySelector('#main').click();
Also, make use of tabindex to bind keyboard events on non-input elements:
tabindex
main content