title: Jquery array - set and load values
body: <p>I am having 2 divs:</p>
  
  <pre><code>&lt;div id="player" class="setPlayers"&gt;value1&lt;/div&gt;
  &lt;div id="player2" class="setPlayers"&gt;value2&lt;/div&gt;
  </code></pre>
  
  <p>All I want to do is to set the value1 and value2 of the divs to an array for reading later on; I tried out this code, but doesn' t work:</p>
  
  <pre><code>var array = new Array();
  
  $.each($('.setPlayers'), function(key, object) {
      console.log(index + ':' + value);
      array.push(value);
      alert(value);
  });
  
  $.each(array, function(index, value) {
      console.log(index + ':' + value);
      console.log(index + ':' + $(this).val());
  });​
  </code></pre>
  
  <p>what' s wrong according to you ?,cheers</p>