The loop does not seem to iterate correctly:
var selections = $("#primaryModal").find("select").not(".hidden");
for(var i = 0; i < selections.length; i++){
console.log(selections.length);
console.log("select");
for(var i = 0; i < $(selection)[0].options.length; i++){
console.log("option");
}
}
Above is my loop and the following is the result in console:
What seems to be the issue here? The internal loop seems to work, but the outer loop iterates only once despite an array length of 2.

ifor both the loop. so your inner loop resets theito6(in your case) which fails the parent conditioni<2. try mapping your inner loop with different variable