title: Javascript key value array storing
body: <p>I am here today with a question to do with key value pair arrays.</p>
  
  <p>my html is as follows</p>
  
  <pre><code>&lt;input type="checkbox" class="data" id="task_checked" value="1" email="a@a.com"&gt;
  &lt;input type="checkbox" class="data" id="task_checked" value="2" email="b@b.com"&gt;
  </code></pre>
  
  <p>I would like to store the following data as an array like below:</p>
  
  <pre><code>"1" =&gt; "a@a.com"
  "2" =&gt; "b@b.com"
  </code></pre>
  
  <p>My Javascript currently is as follows:</p>
  
  <pre><code>var newTasksArr = new Array();
  
  $("#task_checked:checked").each(function() {
      var email = $(this).attr("email");
      var id = $(this).val();
      newTasksArr['id'] = email;
  
  });
  </code></pre>
  
  <p>Perhaps I am using the Jquery .each() wrong, could someone shed some light in to my question please?</p>
  
  <p>Thank you for you reading.
  Regards.</p>