Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Keygen type Property

  • Last Updated : 05 Oct, 2021

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


Return the keygen type property.


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.  


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


 Supported Browsers:

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!