The Truth About HTML5 by Luke Stevens & RJ Owen

The Truth About HTML5 by Luke Stevens & RJ Owen

Author:Luke Stevens & RJ Owen
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Autofocus

<input type="text" autofocus>

The boolean autofocus attribute automatically assigns focus to a given input when the page loads. The quickest way to see this in action is to go to http://google.com ; the search box is automatically focused, and you can start typing right away. This is typically done with JavaScript, but it can be a nuisance to some users. For example, with my focus now in Google’s search box, I can’t use the Delete key to go back a page in my history; it thinks I want to delete text in the search field instead.

To deal with this (rather mild) problem, HTML5 moves this autofocus functionality into markup, instead of relying on JavaScript, so your browser can (theoretically) disable it with a preference or extension.

All modern browsers support Autofocus. Support in IE began with version 10but Mark Pilgrim details a fallback script here for IE9 and below: http://diveintohtml5.info/forms.html#autofocus .



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.