title: jQuery .each() index value
body: <p>I’ve been teaching my self JavaScript and jQuery for a few months, but I’m still getting confused with JavaScript objects and jQuery objects.</p>
  
  <p>In the following example I assigned a jQuery object to the variable <code>$target</code>. The <code>$target</code> should consist of an array of two objects.</p>
  
  <p>My question is why I have to wrap the <code>value</code> variable again into the jQuery object in <code>.each()</code> function ?</p>
  
  <pre><code>$('select.to_append').change(function(){
      var $target = $('select.to_append');
      var $form = $('#anotherForm');
  
      $.each($target, function(key, value){
          $form.append('&lt;input name="' + $(value).attr('name') + '" type="hidden" value="' + $(value).val() + '"&gt;&lt;/input&gt;');
      });
  });
  </code></pre>
  
  <p>The sample code I use to append values from selects which are not parts of the form being submitted;</p>