HTML <keygen> autofocus Attribute
The HTML <keygen> autofocus Attribute is used to specify that the <keygen> element should get focused when the page loads. It is a boolean attribute.
Note: It supports only the following elements: <button>, <input>, <select> and <textarea>
Syntax:
<keygen autofocus>
Example: Below example illustrates the autofocus attribute of the <keygen> element.
HTML
<!DOCTYPE html><html><body style="text-align: center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>HTML Keygen autofocus attribute</h2> <form> Username: <input type="text" name="uname"> <br><br> Encryption: <keygen form="myGeeks" name="secure" autofocus> <input type="submit"> </form></body></html> |
Output:

Supported Browsers:
- Google Chrome 13.0
- Opera 11.0
- Safari 6.0
- Internet Explorer Not supported
- Firefox Not supported


