09 March 2011

Make HTML elements like DIV, SPAN, Table focusable

Hello,

When you need to detect onkeydown event it is fine to do this with focusable elements like: inputs, dropdowns,..., but what to do with non-focusable elements like DIVs, SPANs, TABLEs?

You can achieve this by adding TABINDEX attribute to these elements, this way browsers will consider that element as a focusable element.

Also depending of what value you set to tabindex attribute - it will behave differently:

Need more? Leave comments and subscribe to my blog.

.