I need help creating a loop that will generate the following output:
"1 dropdown1, 1 dropdown2, 2 dropdown3, 2 dropdown4, 3 dropdown5, 3 dropdown5...... "
either as a string or an array.
This is the code I have written so far, but I have hit a roadblock:
var selects = document.getElementById("getAllRecordsDiv").getElementsByTagName("select");
for(var l = 0; l < selects.length; l++) {
for (var i = 0; i < 2; i++) {
var options = i + " " + selects[l].options[selects[l].selectedIndex].text;
}
}
<div id="getAllRecordsDiv" style="border: 2px solid gray; padding: 5px; display: none">
<select name="" id="dd1" style="" onchange="">
<option value="0">one</option>
<option value="0">two</option>
</select>
<select name="" id="dd2" style="" onchange="">
<option value="0">three</option>
<option value="0">four</option>
</select>
<select name="" id="dd3" style="" onchange="">
<option value="0">five</option>
<option value="0">six</option>
</select>
<select name="" id="dd5" style="" onchange="">
<option value="0">seven</option>
<option value="0">eight</option>
</select>
</div>
Any assistance would be greatly appreciated.