Reputation: 45
Want to ask, how do you move the cursor automatically after selecting the form select option?
<select name="id" class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type="text" name="name" class="form-control">
I want after I select select the cursor will automatically go to the text name input form
Upvotes: 2
Views: 992
Reputation: 1
Maybe you're looking for something like this:
var select = document.querySelector('select');
var input = document.querySelector('input');
select.addEventListener('change', function () {
input.focus();
});
<select name="id" class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type="text" name="name" class="form-control">
Upvotes: 3