I wanna create select drop down list where selected value will be depends on input value. Example:
If i write 0 in <input type='text' name='answer' id="ans" oninput="myFunction();">
than will be selected dynamically value NO.
<select id="abcd">
<option value="1">OK</option>
<option value="0">NO</option>
</select>
My attempts
function myFunction() {
var x = document.getElementById('ocena7');
if (x == 0)
{
document.getElementById("abcd").selectedIndex = 2;
}}
Greetings