The CSS works fine when you can set that in advance... but this cant. I'm wrapping the textarea in a div using javascript, so need to be able to get the width through javascript to set it to... which is why i need to find the % width.
On Feb 16, 6:53 pm, Iain <[email protected]> wrote: > You don't need javascript for this, just css. > > .wrapper { width: 90%; } > .wrapper textarea { width: 100%; } > > if you want to do this with javascript, you can do window.addEvent > ( 'resize', ... ) and use pixel values which would have the same > effect. may be slower though. > > On Feb 16, 8:10 am, ryan <[email protected]> wrote: > > > I have a textarea that is a percentage width, and im wrapping it in a > > div that has the same width as the textarea. I want the div to resize > > like the textarea would if that page is resized... rather than be a > > fixed size. > > > On Feb 16, 3:01 pm, keif <[email protected]> wrote: > > > > Sounds like you might have to loop through the stylesheet itself. > > > > I'm curious though, why you need the % value? Perhaps someone could > > > suggest an alternative method if we knew why you needed percentage > > > (just a thought) > > > > On Feb 16, 3:34 am, ryan <[email protected]> wrote: > > > > > Nope - it always returns pixels in safari and firefox ... but I need > > > > percent. > > > > > On Feb 15, 11:42 pm, Iain <[email protected]> wrote: > > > > > > $( 'myElement' ).getStyle( 'width' ) should return the correct value, > > > > > whether it is in pixels or percent. > > > > > > On Feb 15, 2:44 am, ryan <[email protected]> wrote: > > > > > > > Hello > > > > > > > MooTools very helpfully converts all widths to pixel values, which > > > > > > 99% > > > > > > of the time is what I want. However, just this once I need to know > > > > > > what the original % width is. Is there any way of getting it? > > > > > > > When i do something like el.style.width it just returns a blank > > > > > > value > > > > > > in Firefox and Safari... which isnt helpful. The element has already > > > > > > been wrapped in $() if that affects anything... > > > > > > > All suggestions gratefully received! > > > > > > > Ryan
