title: Looping through select tags and creating an array or string
body: <p>I'm trying to loop through select tags with the following output:</p>
  
  <p>"1 dropdown1, 1 dropdown2, 2 dropdown3, 2 dropdown4, 3 dropdown5, 3 dropdown5...... "</p>
  
  <p>string or array.</p>
  
  <p>This is what I have so far but I'm stuck</p>
  
  <pre><code>var selects = document.getElementById("getAllRecordsDiv").getElementsByTagName("select");
  for(var l = 0; l &lt; selects.length; l++) {
      for (var i = 0; i &lt; 2; i++) {
          var options = i + " " + selects[l].options[selects[l].selectedIndex].text;
      }            
  }
  
      &lt;div id="getAllRecordsDiv" style="border: 2px solid gray; padding: 5px; display: none"&gt;        
         &lt;select name="" id="dd1" style="" onchange=""&gt;
            &lt;option value="0"&gt;one&lt;/option&gt;
            &lt;option value="0"&gt;two&lt;/option&gt;            
         &lt;/select&gt;
         &lt;select name="" id="dd2" style="" onchange=""&gt;
            &lt;option value="0"&gt;three&lt;/option&gt;
            &lt;option value="0"&gt;four&lt;/option&gt;
         &lt;/select&gt;
         &lt;select name="" id="dd3" style="" onchange=""&gt;
            &lt;option value="0"&gt;five&lt;/option&gt;
            &lt;option value="0"&gt;six&lt;/option&gt;            
         &lt;/select&gt;
         &lt;select name="" id="dd5" style="" onchange=""&gt;
           &lt;option value="0"&gt;seven&lt;/option&gt;
           &lt;option value="0"&gt;eight&lt;/option&gt;           
         &lt;/select&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>