Keygen autofocus property
Example
Check whether the keygen field automatically gets focus when the page loads:
var x = document.getElementById("myKeygen").autofocus;
x The output result is:
true
Try it »
Definition and usage
The autofocus property sets or returns whether the keygen field automatically gets focus when the page loads.
This property is the HTML autofocus attribute.
Browser support

All major browsers support the autofocus property, except Internet Explorer.
Note:
Syntax
Return the autofocus property:
keygenObject
.autofocus
Set the autofocus property:
keygenObject
.autofocus=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the keygen field gets focus when the page loads.
|
Technical description
| Return value: | Boolean value, returns true if the keygen field automatically gets focus when the page loads, otherwise returns false |
|---|
Related pages
HTML Reference Manual: HTML
Keygen Object