TextArea width

L

Liming

Hi,

I'm using a third party libray and I can drag a diveand resize it. The
issue is, I have a textarea inside of it and I need to resize the width
of textarea and height of textarea along with it.

I know what the width and height of the div will be when it finishes
dragging (in "px"), so how do I convert the width and height in "px" to
the cols and rows of a textarea?

thanks!

Limign
 
I

Ivo

"Liming" schreef
Hi,

I'm using a third party libray and I can drag a diveand resize it. The
issue is, I have a textarea inside of it and I need to resize the width
of textarea and height of textarea along with it.

I know what the width and height of the div will be when it finishes
dragging (in "px"), so how do I convert the width and height in "px" to
the cols and rows of a textarea?

You don't. You specify the new sizes of the textarea in pixels, in the exact
same way as you do with the div element. It is perhaps possible to calculate
the number of pixls that a col or row takes up by measuring, adding a row
and measuring again, but setting RefToTextarea.style.width = '400px'
directly allows setting the dimensions in much finer detail.
hth
ivo
 
L

Liming

ah, thanks lvo. I dont' know why I didn't think about it. Just got
stuck in that idea and never thought about setting via style property.
THANKS. it works perfectly now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top