title: jQuery: array function stops after first item
body: <p>I would like to use the following function to create a dropdown with the unique values of a column. </p>
  
  <p>The function creates the dropdown but only shows the first value of the column there instead of all unique values from that column. </p>
  
  <p>What is wrong or missing here?</p>
  
  <pre><code>function createDropdownFromColumn() {
      var arr = [];
      $("td:first").each(function() {
          if ($.inArray($(this).text(), arr) == -1)
              arr.push($(this).text());
      });
  
      // create select
      var select = $("&lt;select /&gt;");
      for (var i = 0; i &lt; arr.length; i++) {
          $("&lt;option&gt;" + arr[i] + "&lt;/option&gt;").appendTo(select);
      }
  
      // append select
      select.appendTo("body");
  }
  </code></pre>