0
<textarea style="resize: vertical; height: 200px;"></textarea>
<textarea style="resize: vertical; height: 200px;"></textarea>

The above code creates 2 textareas positioned side to side. Just in case, here is a fiddle.

I want to make it such that if either of the textareas are resized, the other textarea will be resized (relative to the height of the other textarea). So how do I accomplish that?

chris97ong
  • 6,870
  • 7
  • 32
  • 52
  • possible duplicate of [Resize event for textarea?](http://stackoverflow.com/questions/5570390/resize-event-for-textarea) – Paul Rad Feb 22 '14 at 11:20
  • ok and I really want to eat some Cheerios but I'm to lazy to go to the superMarket – Andreas Louv Feb 22 '14 at 11:22
  • @PaulRad-Dupuy It may not be, Im not sure how to change the height of the textarea relative to the other textarea – chris97ong Feb 22 '14 at 11:22
  • 3
    You can take help of this link http://jsfiddle.net/butani_vijay010/Z7HDn/67/ – Butani Vijay Feb 22 '14 at 11:27
  • This topic should help if you want to do it with pure JS: http://stackoverflow.com/questions/16937721/how-to-detect-textarea-size-change-with-pure-javascript – Liberat0r Feb 22 '14 at 11:38

2 Answers2

2

This may be Help You

Your HTML

<textarea id="txt1"></textarea>
<textarea id="txt2"></textarea>

Jquery:

$("#txt1").resizable({
    resize: function() {
        $("#txt2").width($(this).width());
        $("#txt2").height($(this).height());


    }
});

You can also refer JSFiddle

Butani Vijay
  • 4,181
  • 2
  • 29
  • 61
0

You could try playing around with the onresize Event

Definition and Usage
The onresize event occurs when the size of an element has changed.
Syntax:
In HTML:

<element onresize="SomeJavaScriptCode">


In JavaScript:

window.onresize=function(){SomeJavaScriptCode};

Hope you can figure it out.