Textarea type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

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>
<html>
<body>

<textarea id="myTextarea" rows="4" cols="50">
new value//from   ww  w  .jav  a2  s. co  m
</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>

Related Tutorials