onfocus is an event in HTML and JavaScript that triggers when the referenced object gains focus. This tag should be used only in conjunction with the primary language tag, and only for questions where the onfocus event is central to the issue(s) being addressed.
The focus event triggers when a visitor focuses on an element.
Not all elements are focusable by default. For example, INPUT and all types or form fields support this event, A supports it. As a counterexample, DIV doesn't support focus.
The list of elements types which support focusing is slightly different between browsers.