David Ogilo

menu search

How to add keyboard events on static HTML elements

I recently stumbled upon an issue when trying to trigger keyboard events on an element and thought I did share how I managed to get it to work.

It seems you’ll need to add a tabindex attribute to the element if you want a keyboard event to be triggered according to this article. The element also needs the focus event activated on it for this technique to work.

Tags: , , ,

Old school browser detected!

Your browser is out of date, which means you can't use any of the site's required features. You can either upgrade your browser or switch to either Mozilla Firefox or Google Chrome