What is the difference between these two events: focus
and focusin
?

- 22,904
- 4
- 58
- 91

- 112,777
- 145
- 353
- 547
-
2http://stackoverflow.com/questions/7858979/difference-between-focusin-focusout-and-focus-blur-with-example – zloctb Feb 01 '17 at 14:41
4 Answers
The focusin
event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event, in that it supports detecting the focus
event on parent elements (in other words, it supports event bubbling).
This event will likely be used together with the focusout
event.

- 14,289
- 10
- 80
- 109

- 23,119
- 19
- 77
- 102
The focusin event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).

- 48,585
- 17
- 95
- 104
According to the jQuery focusin
documentation:
The focusin event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).

- 22,904
- 4
- 58
- 91
The focusin events bubble, the focus events doesn't. That means that you can use the focusin on the parent element of a form field.

- 318
- 3
- 5