この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
この記事を English (US) で読むこともできます。

The onfocus property of the GlobalEventHandlers mixin is an EventHandler that processes focus events on the given element.

The focus event is raised when the user sets focus on an element.

Syntax

element.onfocus = funcRef

Notes

For onfocus to fire on non-input elements, they must be given the tabindex attribute (see Building keyboard accessibility back in for more details).

In contrast to MSIE, in which almost all kinds of elements receive the focus event, almost all kinds of elements on Gecko browsers do NOT work with this event.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'onfocus' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

ドキュメントのタグと貢献者

最終更新者: mfluehr,