title: Simplify repetitive jQuery function
body: <p>This code feels very repetitive, and I am sure there is a more efficient way to write it. Any help would be much appreciated. </p>
  
  <p>jQuery:</p>
  
  <pre><code>$(function(){
  
        $('.perry_1_txt').keyup(function(){
           $('.perry_1').text($(this).val());
        });
  
        $('.perry_2_txt').keyup(function(){
           $('.perry_2').text($(this).val());
        });
  
        $('.perry_3_txt').keyup(function(){
           $('.perry_3').text($(this).val());
        });
  
        $('.perry_4_txt').keyup(function(){
           $('.perry_4').text($(this).val());
        });
  
        $('.perry_5_txt').keyup(function(){
           $('.perry_5').text($(this).val());
        });
  
        $('.perry_6_txt').keyup(function(){
           $('.perry_6').text($(this).val());
        });     
  
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div&gt;
  &lt;input class="perry_1_txt" /&gt;&lt;span class="perry_1"&gt;&lt;/span&gt;
  &lt;input class="perry_2_txt" /&gt;&lt;span class="perry_2"&gt;&lt;/span&gt;
  &lt;input class="perry_3_txt" /&gt;&lt;span class="perry_3"&gt;&lt;/span&gt;
  &lt;input class="perry_4_txt" /&gt;&lt;span class="perry_4"&gt;&lt;/span&gt;
  &lt;input class="perry_5_txt" /&gt;&lt;span class="perry_5"&gt;&lt;/span&gt;
  &lt;input class="perry_6_txt" /&gt;&lt;span class="perry_6"&gt;&lt;/span&gt;
  &lt;input class="perry_7_txt" /&gt;&lt;span class="perry_7"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The code dynamically takes the value from the inputs and places them in the corresponding span. It works fine, but it less than elegant.</p>