HTML | DOM Textarea form Property

The DOM Textarea form Property is used to return the text area by reference to the form that contains that text area. It returns the form object if the code successfully runs or if the text area is in the form.



Return Value:

  • If text area is not contained in the form then it returns the reference of the form that contains the text area.
  • Otherwise, If text area is not contained in the form then it returns NULL.

Example: HTML program to illustrate the DOM Textarea form Property.





<!DOCTYPE html>
    <title>DOM Textarea form Property</title>
        body {
            text-align: center;
        h2 {
            text-align: center;
    <h1 style="color: green;"
        DOM Textarea form Property 
    <form id="Geeks">
        <textarea id="GFG" name="GFG_text">
            Portal for geeks.
    <button type="button"
    <p id="sudo"> </p>
        function myGeeks() {
            var x = document.getElementById("GFG").form;
            document.getElementById("sudo").innerHTML = x;


Before Clicking On Button:

After Clicking On Button:

Note: Above code prints the object of the form type. To print the id or name of the form use instead of form only in the script.

Supported Browsers: The browser supported by Textarea defaultValue Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.