I've got an HTML textarea whose width is set to 100% of the browser window, using CSS.
How can I calculate how many columns of text fit within the textarea?
I've got an HTML textarea whose width is set to 100% of the browser window, using CSS.
How can I calculate how many columns of text fit within the textarea?
The DOM textarea object supports a method cols
that can be used to get or set the number of column of the textarea.
var numCols = document.getElementById('myTextArea').cols
More info on Textarea at w3cschools.