How do I associate input with textarea?

How do I link <input type="text"> to <textarea>?

Eg:

There is a field <textarea>, it is already filled with say this (this text is what is inside textarea=500).
Below there is a field <input type="text"> inside filled in (500).
How do I make it so that if I write any number inside <input type="text"> for example 700, then it would replace 500 which is inside <textarea> and it would become like this (this is what is inside textarea=700)?

Author: DOsS, 2013-03-25

1 answers

Html code:

  <input class="input" type="text" value=""/>
  <textarea class="textarea" rows="3" cols="10">700</textarea>

JQuery code, after loading the page:

 var $textarea = $(".textarea");
 $(document).on('keyup','.input', function(){
     $textarea.text($(this).val());
 });

Same on jsfiddle.net

UPDATE: Updated the example. Now there is a part of the text that doesn't change.

 2
Author: Гена Царинный, 2013-03-25 10:03:54