autofocus

Jump to: navigation, search

autofocus

This page has been flagged with the following issues:

High-level issues:


W3C Candidate Recommendation

Summary

Provides a way to direct a user to a specific field when a document loads.


Applies to HTMLInputElement

This is the one of the important attribute introduced in HTML5 for UX. When used on an element, focus is set on that element on page load or when its dialog is shown (such as when a modal window is shown).

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. Only one element on each page can have the autofocus field.

Examples

HTML

<input id="search_box" autofocus>



Related specifications

Specification Status Related Changes
HTML5 W3C Candidate Recommendation

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 6+
4+
10
11+
5+

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?

See also

Related articles

HTML







  • autofocus












































… further results


External resources

Related pages (MSDN)

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]