HTMLElement.blur()

O método HTMLElement.blur() remove o foco do teclado no elemento corrente.

Sintaxe

elemento.blur();

Exemplos

Removendo o foco de um input de texto

HTML

<input type="text" id="meuTexto" value="Texto Exemplo">
<br><br>
<button type="button" onclick="focusInput()">Clique para definir o foco</button>
<button type="button" onclick="blurInput()">Clique para remover o foco</button>

JavaScript

function focusInput() {
  document.getElementById('meuTexto').focus();
}
function blurInput() {
  document.getElementById('meuTexto').blur();
}

Resultado

Especificação

Especificação Status Comentário
HTML Living Standard
The definition of 'blur' in that specification.
Padrão em tempo real  
HTML 5.1
The definition of 'blur' in that specification.
Recomendação  
HTML5
The definition of 'blur' in that specification.
Recomendação  
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'blur' in that specification.
Obsoleto  

Compatibilidade com navegadores

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
blurChrome Full support 1Edge Full support 12Firefox Full support 5IE Full support 9Opera Full support 8Safari Full support 3WebView Android Full support 4.4Chrome Android Full support 18Firefox Android Full support 5Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support  
Full support

Veja também