Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Keygen disabled Property

Improve Article
Save Article
  • Last Updated : 13 Dec, 2021
Improve Article
Save Article

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. 


Return the disabled property.


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


Supported Browsers: 

  • Google Chrome
  • Firefox
  • Apple Safari
  • Opera

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!