The following code behaves different when tab and enter keys are pressed:
--tab replaces the text field's value with the value of the selected item and focus goes to the next input box
--enter replaces the text field's value with the value of the selected item but the focus does not go to the next input box
How do I change the behavior of enter so that the focus goes to the next input box?
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0
});
I have tried to add the following line:
select: function(event, ui) { if (event.keyCode == 13) { trigger({ type : 'keypress', which : 9 }); } }
This doesn't work. See /
The following code behaves different when tab and enter keys are pressed:
--tab replaces the text field's value with the value of the selected item and focus goes to the next input box
--enter replaces the text field's value with the value of the selected item but the focus does not go to the next input box
How do I change the behavior of enter so that the focus goes to the next input box?
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0
});
I have tried to add the following line:
select: function(event, ui) { if (event.keyCode == 13) { trigger({ type : 'keypress', which : 9 }); } }
This doesn't work. See http://jsfiddle/YbPVX/4/
Share Improve this question asked Jul 31, 2011 at 22:31 RandomblueRandomblue 116k150 gold badges363 silver badges558 bronze badges1 Answer
Reset to default 6Try this
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0,
select: function(event, ui) { if (event.keyCode == 13) {
$(this).next("input").focus().select();
} }
});
-> http://jsfiddle/YbPVX/5/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745171251a4614938.html
评论列表(0条)