Jump to content

ok new thing, dynamic textareas


optikalefx

Recommended Posts

Ive been looking around, and I really wanted a textarea that extends horizontally as you type only to the page width of course, and when you hit enter, the textarea extends vertically. Moreover, i wrote a script that takes the innerHTML of an element and places it in a textarea, how can i make the 'dynamic' textarea become the size of the text it inherited.

 

here is an examle of an extending textarea that doesnt work in FF but does in safari.

http://www.felgall.com/jstip45.htm

 

here is my get page width

var pageX = (document.all)?document.body.offsetWidth:window.innerWidth;

and right now heres how im setting the width and heigh of the textarea

style_w = (document.getElementById(cur_id))?document.getElementById(cur_id).offsetWidth:window.innerWidth;
style_h = (document.getElementById(cur_id).style.offsetHeight);

and then applying it to the textarea, element y

 

y.style.width = style_w;
y.style.height = style_h;

thanks to anyone who can help me out!

Link to comment
https://forums.phpfreaks.com/topic/89924-ok-new-thing-dynamic-textareas/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.