MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

HTMLElement.focus()

Esta tradução está incompleta. Por favor, ajude a traduzir este artigo.

The HTMLElement.focus() method sets focus on the specified element, if it can be focused.

Síntaxe

element.focus()

Especificação

Especificação Status Comentário
WHATWG HTML Living Standard
The definition of 'focus' in that specification.
Living Standard  
HTML5.1
The definition of 'focus' in that specification.
Working Draft  
HTML5
The definition of 'focus' in that specification.
Recommendation  
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'focus' in that specification.
Recommendation  
Document Object Model (DOM) Level 1 Specification
The definition of 'focus' in that specification.
Recommendation  

Notas

If you call HTMLElement.focus() from a mousedown event handler, you must call event.preventDefault() to keep the focus from leaving the HTMLElement.

Veja também

Etiquetas do documento e colaboradores

 Colaboradores desta página: brunopulis
 Última atualização por: brunopulis,