This page has been flagged with the following issues:
Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
For example if we look at Facebook home page you can see that cursor is automatically pointed to email id field which makes user to just type in the credentials.
Let's have an example for the same.
<input id="search_box" autofocus>
Needs Examples: This section should include examples.
Only one control in a document can have autofocus specified. If more than one element has the attribute, only the first one in the page will get the focus when the page opens. This is a boolean attribute, requiring only the presence of the attribute to be true. The following example shows a field that will receive focus when a page opens. Note For more code samples, see Form controls part 1 and Form controls part 2: validation on the Windows Internet Explorer sample site.
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 184.108.40.206
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic Support||6+||4+||10|| 11+
|Feature||Android||BlackBerry||Chrome for mobile||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Opera Mini||Safari Mobile|
Related pages (MSDN)
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]