MLMLTL MLMLTL - 7 months ago 10
Javascript Question

Dynamically set the height of a Button to be the height of a Textarea

This is a little thing, but I can't find anything at all in regard on how to go about doing it!

In the picture below, there is a

textarea
with a styled (and disabled)
button
purely for aesthetic purposes:

enter image description here

But when you resize the
textarea
, this happens:

enter image description here

This doesn't look so great.

I want to tie the dynamic height of the
textarea
to the height of the
button
so that they stay together at whatever height, but I cant find anything like this.

How do you tie an elements styling to another's?

Note - Much more confident at PHP than jQuery/javascript, but obviously won't refuse answers in those languages.

Answer

Either disable the resise of textarea using the following :


textarea {
    resize: none;
}

or use this fiddle(I did not create it) by making necessary changes.


http://jsfiddle.net/gbouthenot/D2bZd/