Friday, 30 December 2011

HTML5 - Autofocus Form Attribute

Autofocus Attribute

The autofocus attribute specifies that a field should automatically get focus when a page is loaded.
Note: The autofocus attribute works with all <input> types.

Syntax

User name: <input type="text" name="user_name"  autofocus="autofocus" /> 

Example

  <!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp" method="get">
User name: <input type="text" name="user_name" autofocus="autofocus" />
<input type="submit" />
</form>

</body>
</html>

No comments:

Post a Comment