Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<textarea id="myTextarea" rows="4" cols="50">
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
<p>Click the button to display the value of the cols attribute of the text area.</p>
<button type="button" onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myTextarea").cols;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>