Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML <keygen> autofocus Attribute

Improve Article
Save Article
Like Article
  • Last Updated : 17 Sep, 2021
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
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!