From ff9ea0cf9f0ea6217deefa7ad0dba35bf7f6c45e Mon Sep 17 00:00:00 2001 From: MDN Date: Thu, 8 Jul 2021 00:34:19 +0000 Subject: [CRON] sync translated content --- .../web/api/htmlorforeignelement/blur/index.html | 88 ++++++++++++++++++++++ .../web/api/htmlorforeignelement/focus/index.html | 63 ++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html (limited to 'files/pt-br/orphaned') diff --git a/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..2ce85ac57e --- /dev/null +++ b/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,88 @@ +--- +title: HTMLElement.blur() +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - API + - DOM HTML + - Foco + - HTMLElement + - Referencia + - metodo +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +
{{ APIRef("HTML DOM") }}
+ +

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

+ +

{{ EmbedLiveSample('Remove_focus_from_a_text_input') }}

+ +

Especificação

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}} 
+ +

Compatibilidade com navegadores

+ +

{{Compat("api.HTMLElement.blur")}}

+ +

Veja também

+ + diff --git a/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..d2da909bc6 --- /dev/null +++ b/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,63 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

O método HTMLElement.focus()  seta o foco em um determinado elemento em especifico, caso esse elemento permita ter o foco neste elemento.

+ +

Síntaxe

+ +
element.focus()
+ +

Especificação

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}} 
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}} 
+ +

Notas

+ +

Caso você utilize o HTMLElement.focus() por meio da manipulação de um evento mousedown , você deve utilizar o evento event.preventDefault() a fim de o foco não sair do arquivo HTMLElement.

+ +

Veja também

+ + -- cgit v1.2.3-54-g00ecf