In this tutorial, you will see the use of autofocus and required attribute of input tag.
In this tutorial, you will see the use of autofocus and required attribute of input tag.Here we will introduce you to about the autofocus and required attribute of input tag.
Type Attribute:Attribute | Value | Description |
autofocus required |
autofocus required |
Automatically focus when page load. User must fill this field. |
<input type="value" attribute/> |
<!doctype html > <html> <head> <title>Title of document.</title> </head> <body><h2>Input tag.</h2> <h2>Implementation of attributes of input tag. </h2> <form ><table > <tr> <td style="width: 198px">Name</td> <td><input type="Text" ></td> </tr> <tr> <td style="width: 198px">Autofocus attribute</td> <td><input type="Text" autofocus></td> </tr> <tr> <td style="width: 198px">Required</td> <td><input type="Text" required></td> </tr> <tr> <td style="width: 198px"><input type="reset" value="Reset" ></td> <td><input type="submit" value="Submit" ></td> </tr> </table></form> </body> </html> |
The input tag is available in both HTML5 and HTML4.01. But there is some attribute in HTML5, that is not supported by HTML4.01.