Textarea cols Property - Get the width of the text area, in characters: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

Textarea cols Property - Get the width of the text area, in characters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<textarea id="myTextarea" rows="4" cols="50">
new value//from  w  ww  . j a v a2 s  .c  o m
</textarea>

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

<script>
function myFunction() {
    var v = document.getElementById("myTextarea").cols;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials