diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:36:08 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:36:08 +0100 |
commit | 39f2114f9797eb51994966c6bb8ff1814c9a4da8 (patch) | |
tree | 66dbd9c921f56e440f8816ed29ac23682a1ac4ef /files/fr/web/api/htmlorforeignelement/blur/index.html | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.gz translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.bz2 translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.zip |
unslug fr: move
Diffstat (limited to 'files/fr/web/api/htmlorforeignelement/blur/index.html')
-rw-r--r-- | files/fr/web/api/htmlorforeignelement/blur/index.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/files/fr/web/api/htmlorforeignelement/blur/index.html b/files/fr/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..6c5f12166c --- /dev/null +++ b/files/fr/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,88 @@ +--- +title: HTMLElement.blur() +slug: Web/API/Element.blur +tags: + - API + - DOM + - HTMLElement + - Method + - Reference +translation_of: Web/API/HTMLOrForeignElement/blur +--- +<div> +<div>{{ APIRef("HTML DOM") }}</div> +</div> + +<p>La méthode <code><strong>HTMLElement.blur()</strong></code> retire le focus de l'élément courant.</p> + +<h2 id="Syntax" name="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>elt</em>.blur()</pre> + +<h2 id="Specification" name="Specification">Exemples</h2> + +<h3 id="Remove_focus_from_a_text_area" name="Remove_focus_from_a_text_area">Retirer le focus d'un champ texte</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token"><</span>input</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>text<span class="punctuation token">"</span></span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>myText<span class="punctuation token">"</span></span> <span class="attr-name token">value</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"Champ texte</span><span class="punctuation token">."</span></span><span class="punctuation token">></span></span> +<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>p</span><span class="punctuation token">></span></span><span class="tag token"><span class="tag token"><span class="punctuation token"></</span>p</span><span class="punctuation token">></span></span> +<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>button</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>button<span class="punctuation token">"</span></span> <span class="attr-name token">onclick</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>focusMethod()<span class="punctuation token">"</span></span><span class="punctuation token">>Cliquez-moi pour donner le focus</span></span><span class="tag token"><span class="tag token"><span class="punctuation token"></</span>button</span><span class="punctuation token">></span></span> +<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>button</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>button<span class="punctuation token">"</span></span> <span class="attr-name token">onclick</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>blurMethod()<span class="punctuation token">"</span></span><span class="punctuation token">>Cliquez-moi pour retirer le focus</span></span><span class="tag token"><span class="tag token"><span class="punctuation token"></</span>button</span><span class="punctuation token">></span></span></code></pre> + +<h4 id="JavaScript">JavaScript</h4> + +<pre class="brush: js line-numbers language-js"><code class="language-js">focusMethod <span class="operator token">=</span> <span class="keyword token">function</span> <span class="function token">getFocus</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">"myText"</span><span class="punctuation token">)</span><span class="punctuation token">.</span><span class="function token">focus</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> +blurMethod <span class="operator token">=</span> <span class="keyword token">function</span> <span class="function token">getBlur</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">"myText"</span><span class="punctuation token">)</span><span class="punctuation token">.</span><span class="function token">blur</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span></code></pre> + +<h4 id="Résultat">Résultat</h4> + +<p>{{ EmbedLiveSample('Remove_focus_from_a_text_area') }}</p> + +<h2 id="Specification" name="Specification">Spécification</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}</td> + <td>{{Spec2('HTML5.1')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}</td> + <td>{{Spec2('DOM2 HTML')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilité navigateur</h2> + + +<p>{{Compat("api.HTMLElement.blur")}}</p> +<p>Dans IE9-10, il y a un bug où appeler <code>blur()</code> sur le {{HTMLElement("body")}} change la fenêtre active du navigateur vers une autre application.</p> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<p>La méthode DOM {{domxref("HTMLElement.focus()")}}</p> |