Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Keygen name Property

Improve Article
Save Article
  • Last Updated : 28 Oct, 2021
Improve Article
Save Article

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.


  • 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
Related Articles

Start Your Coding Journey Now!