Селектор :focus


Содержание:

focus selector

Описание: Selects element if it is currently focused.

  • Добавлен в версии: 1.6jQuery( ":focus" )

As with other pseudo-class selectors (those that begin with a ":"), it is recommended to precede :focus with a tag name or some other selector; otherwise, the universal selector ( "*" ) is implied. In other words, the bare $( ":focus" ) is equivalent to $( "*:focus" ). If you are looking for the currently focused element, $( document.activeElement ) will retrieve it without having to search the whole DOM tree.