Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Keygen type Property

Improve Article
Save Article
  • Last Updated : 28 Sep, 2022
Improve Article
Save Article

The HTML DOM Keygen type property is used to return the type of form element containing the Keygen field. This property will always return “keygen”.

Syntax:  

Return the keygen type property.

 keygenObject.type

Return Values: It returns a string value that represents the type of form element’s keygen field. 

Example: Below program illustrates the use of keygen type property.  

HTML




<!DOCTYPE html>
<html>
 
<head>
    <style>
        h2 {
            color: green;
        }
 
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h2>GeeksforGeeks</h2>
    <p><b>HTML DOM Keygen type Property</b></p>
    <br>
     
    <form id="formID">
        Username:
        <input type="text" name="uname">
        <br><br> Encryption:
        <keygen id="keyid" form="formID"
            name="secure" autofocus>
        <input type="submit">
    </form>
 
    <button onclick="My_form()">
        Return
    </button>
     
    <p id="test"></p>
 
 
    <script>
        function My_form() {
            var d = document.getElementById("keyid").type;
            document.getElementById("test").innerHTML = d;
        }
    </script>
</body>
 
</html>

Output:

 Supported Browsers:

  • Google Chrome
  • Internet Explorer Not supported
  • Opera
  • Firefox
  • Apple Safari

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!