Html 5 Form Autofocus Attribute Tag

In the auto focus attribute tag is used to when page is load focus to specified field automatically. In the autofocus attribute form tag is new in HTML5.In the autofocus attribute tag will work input types.That input types are text, url, search, telephone, password, email ,datepickers,color and range.


<input autofocus="autofocus" />

Example Code

<form action="" method="get">
   User name: <input type="text" name="username" autofocus="autofocus" />   <input type="submit" value="Submit" />

Out Put :

User name: