Textarea type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea


The type property returns which type of form element a text area is.

For a text area object it returns "textarea".

Return Value

Type Description
String The type of form element the text area is

The following code shows how to check which type of form element a text area element is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<textarea id="myTextarea" rows="4" cols="50">
new value//from   ww  w  .jav  a2  s. co  m

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {
    var x = document.getElementById("myTextarea").type;
    document.getElementById("demo").innerHTML = x;


Related Tutorials