HTMLElement.focus()

  • Revision slug: DOM/element.focus
  • Revision title: element.focus
  • Revision id: 30394
  • Created:
  • Creator: ziyunfei
  • Is current revision? No
  • Comment 17 words added

Revision Content

{{ DomRef() }}

Summary

Sets focus on the specified element, if it can be focused.

Syntax

element.focus();

Specification

DOM Level 1 HTML: various elements.focus

DOM Level 2 HTML: various elements.focus

See also

  • {{ domxref("element.blur()") }}
  • {{ domxref("document.activeElement") }}

{{ languages( { "fr": "fr/DOM/element.focus", "pl": "pl/DOM/element.focus" , "zh-cn": "zh-cn/DOM/element.focus" } ) }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Sets focus on the specified element, if it can be focused.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval"><em>element</em>.focus();
</pre>
<h3 id="Specification" name="Specification">Specification</h3>
<p><a class="external" href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#method-focus">DOM Level 1 HTML: <em>various elements</em>.focus</a></p>
<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-32130014">DOM Level 2 HTML: <em>various elements</em>.focus</a></p>
<h3 id="See_also">See also</h3>
<ul> <li>{{ domxref("element.blur()") }}</li> <li>{{ domxref("document.activeElement") }}</li>
</ul>
<p>{{ languages( { "fr": "fr/DOM/element.focus", "pl": "pl/DOM/element.focus" , "zh-cn": "zh-cn/DOM/element.focus" } ) }}</p>
Revert to this revision