Open In App

HTML DOM Keygen disabled Property

Last Updated : 13 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML DOM Keygen disabled property is used to set or return a boolean value that indicates whether a Keygen element should be disabled or not.  A disabled keygen field is unusable. This property is used to reflect the HTML disabled attribute. 

Syntax:  

Return the disabled property.

KeygenObject.disabled

Set the disabled property:

KeygenObject.disabled = true|false

 Property Value: 

  • true|false: It is used to specify whether a keygen field should be disabled or not. It is false by default.

Return Values: It returns a Boolean value that represents the keygen field that is disabled or not. 

Example: Below code demonstrates how to enable and disable the keygen field.   

HTML




<html>
 
<head>
    <title>
        HTML DOM Keygen disabled Property
    </title>
</head>
 
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
     
    <h2>HTML DOM Keygen disabled Property</h2>
    <br>
     
    <form id="myform">
        Username: <input type="text" name="uname">
        <br><br>
        Encryption:
        <keygen id="keygenID" form="myform"
            name="secure" disabled>
 
        <input type="submit">
    </form>
 
     
<p>
        Click on Below Buttons to set
        the Keygen disabled Property
    </p>
 
 
    <button onclick="click1()">Set</button>
    <p id="test"></p>
 
 
    <script>
        function click1() {
            var g = document.getElementById(
                    "keygenID").disabled = true;
 
            alert("Now the value of the disabled"
                + " property is set to " + g);
        }
    </script>
</body>
 
</html>


Output: 

Supported Browsers: 

  • Google Chrome
  • Firefox
  • Apple Safari
  • Opera


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads