Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

HTML <keygen> autofocus Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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>


<keygen autofocus>

Example: Below example illustrates the autofocus attribute of the <keygen> element. 


<!DOCTYPE html>
<body style="text-align: center;">
    <h1 style="color:green;">
    <h2>HTML Keygen autofocus attribute</h2>
        Username: <input type="text" name="uname">
        <br><br> Encryption: <keygen form="myGeeks"
                name="secure" autofocus>
        <input type="submit">


Supported Browsers:

  • Google Chrome 13.0
  • Opera 11.0
  • Safari 6.0
  • Internet Explorer Not supported
  • Firefox Not supported
My Personal Notes arrow_drop_up
Last Updated : 17 Sep, 2021
Like Article
Save Article
Similar Reads
Related Tutorials