Skip to content
Related Articles

Related Articles

How to specify that a keygen element should be disabled in HTML ?

View Discussion
Improve Article
Save Article
  • Last Updated : 17 Mar, 2021

The <keygen>element in HTML helps in encryption key generation so that data can be transferred between the server and client securely. This encryption may affect the user experience and reduce website performance in the case of users with fewer system requirements. This can cause issues in the user interface and may lead to confusion in the usage of the website. Therefore, the need may arise to disable it in unnecessary situations.

This can be achieved by using the disabled attribute of the <keygen> element. This will prevent the element from generating the key-value pairs it is supposed to generate.


<keygen name="security" disabled>

Example: In the below example, the <keygen> element is disabled using the disabled attribute.


  <h1 style="color: green;">
  <h3>Disabling the keygen element</h3>
  <!-- Form for enclosing all the
  available inputs -->
  <form method="post" action="/">
    <label for="name">Your username</label>
    <input type="text" name="name">
    <label for="name">Your password</label>
    <input type="password" name="pass">
    <!-- Disable the <keygen> element using
    the disabled attribute -->
    Encryption Element Value:
    <keygen name="security" disabled>
    <input type="submit">


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!