tags:

views:

33

answers:

1

Is there a way to give a div tag focus when you click on its contents? Using CSS or JQuery?

+1  A: 

The HTML5 draft extends the tabindex attribute so that setting it to 0 or a negative number will make an element focus-able if it isn't usually so.

The usual provisos about new features in drafts having limited browser support and limited support by assistive technologies (such as screen readers) apply.

In general, if you need to be able to give the focus to a control, it is better to pick an element that is designed to accept the focus in the first place.

David Dorward
Daily vote limit reached; come back in 4 hours.
Pekka