G
gilbert.george
Hi,
I am setting the width of a textarea using the style.width to ensure
the textarea is exactly the right width.
I want to set the height/rows of the textarea depending on it's
contents (so that it dynamically grows and shrinks as the contents
alter) however I can not see a way to calculate the required number of
rows (or height) for a given content string.
If all the lines of content are shorter that than the width of the
area then it's simple but obviously this is not always the case, so I
have a function that splits the content into lines then each line into
single words and iterates thro adding words to a tmp string whose
width (not length) i then want to compare with the width of the
textarea however I cant see how I can do that.
I tried to use the number of cols and the length of the string but
the number of cols is not set when the style.width is set.
Anyone have any advice on how to go about this?
G
I am setting the width of a textarea using the style.width to ensure
the textarea is exactly the right width.
I want to set the height/rows of the textarea depending on it's
contents (so that it dynamically grows and shrinks as the contents
alter) however I can not see a way to calculate the required number of
rows (or height) for a given content string.
If all the lines of content are shorter that than the width of the
area then it's simple but obviously this is not always the case, so I
have a function that splits the content into lines then each line into
single words and iterates thro adding words to a tmp string whose
width (not length) i then want to compare with the width of the
textarea however I cant see how I can do that.
I tried to use the number of cols and the length of the string but
the number of cols is not set when the style.width is set.
Anyone have any advice on how to go about this?
G