document.getElementById(DropDownNames[j]+x).value = openerVals
needs to be
document.getElementById(DropDownNames[j]+x).value == openerVals
A single =
will set something equal to another thing (and returns the set value). Since you use this, that means that the result that's used by the if
statement is the truthyness of the set value.
==
is used to evaluate if two things are equal to each other, with type coercion. (2 ==
"2" is true)
===
is used to evaluate if two things are equal to each other, without type coercion. (2 !==
"2" is true)