--- title: element.hasFocus slug: Web/API/Document/hasFocus tags: - Referencia_DOM_de_Gecko translation_of: Web/API/Document/hasFocus ---

{{ ApiRef() }}

Resumen

El atributo hasFocus devuelve true si el foco está en en algún sitio del documento activo. Este atributo es parte de la especificación HTML 5 actualmente en desarrollo.

Sintaxis

focused = element.hasFocus

Ejemplo

Especificación

Focus management