Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Keygen disabled Property

  • Last Updated : 05 Oct, 2021

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:  

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

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.

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!