Javascript Reference - HTML DOM Textarea type Property








The type property returns the type of a textarea.

Browser Support

type Yes Yes Yes Yes Yes

Syntax

var v = textareaObject.type 

Return Value

Type Description
String The type of the textarea




Example

The following code shows how to get the type of a textarea element.


<!DOCTYPE html>
<html>
<body>
<!--   w w  w . j  av  a2s  . c o  m-->
<textarea id="myTextarea" rows="4" cols="50">
this is a test
</textarea>
<button type="button" onclick="myFunction()">test</button>
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myTextarea").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: