I have an form input field, when a user types "text 2", I want that "text 2" selected in the form select:
<select id="formsel">
<option value="text 1">text 1</option>
<option value="text 3">text 2</option>
<option value="text 3">text 3</option>
</select>
<input type='text' id='input' />
I get the value from the input like this:
var input_val = document.getElementById('input').value;
But I can not select the option from the dynamic form select with
document.form.formsel.value = input_val;
Can anyone see what I’m doing wrong?
Based on your comment, it looks like you’re using jQuery (you should tag all questions with jQuery if that’s the case).
This should get you what you want