Horje
HTML DOM Textarea type Property

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



Reffered: https://www.geeksforgeeks.org


HTML

Related
HTML nonce Attribute HTML nonce Attribute
HTML itemscope Attribute HTML itemscope Attribute
Which tag is used to display additional information when we click to open or close on demand in HTML ? Which tag is used to display additional information when we click to open or close on demand in HTML ?
HTML DOM Input Search select() Method HTML DOM Input Search select() Method
HTML DOM Input Range defaultValue Property HTML DOM Input Range defaultValue Property

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
10