title: Adding a list of data to object inside loop
body: <p>I have been attempting to add a list of values into a object/associative array so i can get a list of values from the input of a multiselect plugin. Im wanting to add the name of the input as the object key.</p>
  
  <p>Problem: Doesnt seem to create a list, just updates the last input value in loop...what am i doing wrong here?</p>
  
  <pre><code>var selectObj = {}; 
  
  $('input').each(function(inputKey)
  {
      alert($(this).val());   //all input values shown
      selectObj[$(this).attr('name')] = $(this).val(); 
   });
  
  alert(JSON.stringify(selectObj));    //last input value shown
  </code></pre>
  
  <p><strong>Desired Results:</strong></p>
  
  <ul>
  <li>(1 multi-select): </li>
  </ul>
  
  <blockquote>
    <p>selectObj={"listName1":"12,3,31,4"}</p>
  </blockquote>
  
  <ul>
  <li>(2 multi-select): </li>
  </ul>
  
  <blockquote>
    <p>selectObj={"listName1":"12,3,31,4"},{"listName2":"1,32,43,5"}</p>
  </blockquote>