I want to copy a select’s value to text field when even the select’s value changes.
My code
$(document).ready(function() {
$('#select').change(function() {
$('#text').val($('#select').val());
});
});
This code works only when I change the select’s value using the mouse, but if I focus it and press the up/down arrow key it does not work.
This is expected behavior, the actual value isn’t changed until an option is selected. It should still work when you press “enter” after making a selection with the up/down arrows.
You try and can bind more events if you want, example:
Demo: http://jsfiddle.net/Q2G9F/