title: Append numbers to input field with jQuery
body: <p>I need to copy numbers from package-size div between "/" and "pcs" characters and paste them to input value. In this case number is 100. Is that possible? </p>
  
  <p>Following code works if we have only numbers inside package-size div.</p>
  
  <p>How about if I have multiple product divs?</p>
  
  <pre><code>&lt;div class="product"&gt;
    &lt;div class="package-size"&gt;1/100 pcs.&lt;/div&gt;
    &lt;input type="number" value="1" /&gt;
  &lt;/div&gt;
  
  $( ".package-size" ).val(function() {
    var text = $( this ).text();
    $( "input" ).val( text );
  });
  </code></pre>
  
  <p><strong>Update 1:</strong></p>
  
  <pre><code>&lt;div class="product"&gt;
    &lt;div class="package-size"&gt;
      &lt;p&gt;1/100 pcs.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;span&gt;
        &lt;input type="number" value="1" /&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Update 2:</strong></p>
  
  <pre><code>&lt;div class="product"&gt;
    &lt;div class="package-size"&gt;
      &lt;p&gt;1/100 pcs.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;span&gt;
        &lt;input type="number" value="1" /&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="product"&gt;
    &lt;div class="package-size"&gt;
      &lt;p&gt;200 pcs.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;span&gt;
        &lt;input type="number" value="1" /&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>