There is a code: https://jsfiddle.net/7crsysmy/15/

And JS :

 var counter = {}; var options = document.getElementById('id1').options; for (var i = 0; i < options.length; i++) { counter[options[i].value] = [0, 0, 0]; } var id1 = document.getElementById("id1"); var value1 = id1.options[id1.selectedIndex].value; var id2 = document.getElementById("result_id"); var value2 = id2.options[id2.selectedIndex].value; value2 = value2 - 1; counter[value1][value2]++; 

Now the JS code places into the array the number of times that one or another option is pressed in the allocator ( id2 ), depending on the selected option in the allocator ( id1 ). But instead of a selector ( id1 ), I have a selector created by a script from an array. I understand that he doesn’t have a value like a normal intellectual, and he has all_leagues1[0][0] , where the first digit is the chosen country and the second is the league chosen.

how to remake the script specified above so that an array of each all_leagues1[0][1] , all_leagues1[0][2] ..?

Here I asked a similar question about the script: How to save the result of the selected select to an array? (first answer)

  • property value is at any selector. Pay attention to the button "Code snippet ..." in the question editor - a powerful thing. - Igor
  • I'll know, thanks. However, I can’t understand how to address the value of the second selector, which is selected after the first selector - Victor

0