Open In App

HTML DOM Textarea type Property

Improve
Improve
Like Article
Like
Save
Share
Report

The Textarea type Property in HTML DOM is used to return the type of form element of the Textarea field. Note that, it will always return “textarea” for a Textarea Object.

Syntax:

textareaObject.type

Return Value: It returns a string value that represents the type of form element of the Textarea field.

Example: The below program illustrates the Textarea type property in HTML DOM.

HTML




<!DOCTYPE html>
<html>
 
<body style="text-align:center">
    <h1 style="color: green;">
    GeeksforGeeks
    </h1>
    <b>DOM Textarea type Property</b>
    <br><br>
     
    <!-- Assigning id to textarea. -->
    <textarea id="myGeeks" rows="5" autofocus>
GeeksForGeeks. A computer science portal for Geeks.
    </textarea>
    <br><br>
 
    <button onclick="myGeeks()">Submit</button>
    <p id="sudo" style="font-size:20px;color:green;"></p>
 
 
 
    <script>
        function myGeeks() {
           
            // Get the type of textarea
            var type =
              document.getElementById("myGeeks").type;
           
            // Set the type to the innerHTML
            document.getElementById("sudo").innerHTML = type;
        }
    </script>
</body>
 
</html>


Output:

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5
  • Firefox 1
  • Opera 12.1
  • Safari 1


Last Updated : 22 Jul, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads