Find out if a keygen field automatically gets focus upon page load:
The result of x will be:
The autofocus property sets or returns whether a keygen field should automatically get focus when the page loads, or not.
This property reflects the HTML autofocus attribute.
The autofocus property is supported in all major browsers, except Internet Explorer.
Note: The HTML autofocus attribute for the <keygen> element is not supported in Firefox.
Return the autofocus property:
Set the autofocus property:
Value | Description |
---|---|
true|false |
Specifies whether a keygen field should get focus when the page loads,
or not
|
Return Value: | A Boolean, returns true if the keygen field automatically gets focus when the page loads, otherwise it returns false |
---|
Create a <keygen> element and set autofocus to "true":
HTML reference: HTML <keygen> autofocus attribute