Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Keygen name Property

  • Last Updated : 28 Oct, 2021

The keygen name property in HTML DOM is used to set or return the value of the name attribute of the <keygen> element. The name attribute is used to specify the name of the keygen element.


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

  • It returns the name property.
  • It sets the name property. = keygenName

Return Values: It returns a string value that represents the name of the keygen element.

Property Value: It contains a string value that specifies the name of the keygen element. 

Example: The below HTML code returns and sets the name of the keygen element.


<!DOCTYPE html>
        h1 {
            color: green;
        body {
            text-align: center;
    <h2>HTML DOM Keygen name Property</h2>
    <form id="myGeeks">
        Username: <input type="text" 
        <br><br> Encryption:
        <keygen id="Geeks" form="myGeeks"
                name="secure" autofocus>
        <input type="submit">
    <button onclick="display()">Display</button>
    <button onclick="set_name()">Set</button>
    <p id="test"></p>
        function display() {
            var d = document.getElementById("Geeks").name;
              "The name of the keygen is: " + d);
        function set_name() {
            var g = document.getElementById(
                "Geeks").name = "myKeygen";
                "The name of the Keygen was changed to " + g


Supported Browsers:

  • Google Chrome
  • Opera
  • Safari
  • Firefox

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!