Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Keygen form Property

Improve Article
Save Article
  • Last Updated : 01 Apr, 2022
Improve Article
Save Article

The Keygen form property in HTML DOM is used to return the reference of the form containing the keygen element. It is a read-only property and returns the form object on success.



Return Value: It returns a reference to the form element containing the keygen element. It returns NULL if the keygen is not in the form.

Example: This example shows the working of the Keygen form property.


<!DOCTYPE html>
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
    <h2>HTML DOM Keygen form Property</h2>
    <form id="myGeeks">
        <input type="text" name="uname">
        <br><br> Encryption:
        <keygen id="Geeks" form="myGeeks"
            name="secure" autofocus>
        <input type="submit">
    <button onclick="My_form()">
    <p id="test"></p>
        function My_form() {
            var d = document.getElementById("Geeks");
            document.getElementById("test").innerHTML = d;


Supported Browsers:

  • Google Chrome
  • Opera
  • Firefox
  • Apple Safari

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!