title: Javascript: Loop through class and push the inputs
body: <p>I'm having a problem with pushing some input values to an <code>array</code>. I have a <code>div</code> with a class <code>optiondiv</code> that can be cloned. This div has some table rows with some input fields as follows:</p>
  
  <pre><code>&lt;div class="optiondiv"&gt;
      &lt;table class="tableOptions"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;input type="text" class="title"&gt;
              &lt;/td&gt;
  
              &lt;td&gt;
                  &lt;input type="text" class="position"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;select class="input"&gt;
                      &lt;option value="1"&gt;Drop-down&lt;/option&gt;
                      &lt;option value="2"&gt;Radio Buttons&lt;/option&gt;
                      &lt;option value="3"&gt;Checkbox&lt;/option&gt;
                      &lt;option value="4"&gt;Multiple Select&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="checkbox" class="required"&gt; Required?
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm trying to get all the input fields of the option, for each option and then push them to an array. The problem is that there's no 'split' between each option. If I use <code>console.log();</code>, the values will be printed like this: <code>[Doors, 1, Windows, 5]</code> but what I really want is <br></p>
  
  <pre><code>[0][Doors, 1]
  [1][Windows, 5]
  </code></pre>
  
  <p>This is de code that I'm using:</p>
  
  <pre><code>$('.generateString').click(function (e)
      {
          e.preventDefault();
          $('.optiondiv').each(function(){
              var arrText = new Array();
  
              $('input[type=text]').each(function ()
              {
                 if($(this).val() != ''){
                     // arrText.push('nietleeg');
                     arrText.push($(this).val());
                  }
              })
              console.log(arrText);
          })
  
      });
  </code></pre>
  
  <p>Happy coding!</p>