I have an HTML file with multiple 'select' - each select corresponds to one match of tournament round (eg - for winner there is one select with 'winner' class, for final there are two selects with 'final' class, for semis are four selects with 'semi-final' class and so on). To each select in html I have got 'onchange' parameter provided, like that:
<select onchange="previousRounds()" name="winner" class="winner">
I know that if one select will be changed by JS code it won't trigger onchange parameter. So at the end of my function I put:
get_previous_round[j].onchange();
As I browsed through the I figured it should trigger function that I provided in onchange parameter in "get_previous_round[j]" (this is just a variable that corresponds to one my selects), but it throws an error:
'Cannot read property 'onchange' of undefined at previousRounds'.
I also tried it in console:
console_try = document.getElementsByClassName('final')
console_try[0].onchange()
but the same error occured.
Am I missing something?