jquery autocomplete remove focus after suggest
After sele开发者_高级运维cting an item in the autocomplete list, my script validates the selection but does not release the focus. Ive even tried to place focus on another element to my dissapointment.
This is my code:
var usernames = [<? print_r($jquery_usernames); ?>];
$("#suggest1").autocomplete(usernames);
$("#suggest1").result(function() {
$(this).submit();
setTimeout(function() {
$('#focusdiv').focus();
}, 1);
});
Any suggestions?
This is interesting and works (the focus is removed from the suggest1 input):
$("#suggest1").autocomplete(usernames);
$("#suggest1").result(function() {
$(this).submit();
setTimeout(function() {
$('.next-step').focus();
}, 1);
});
Note: It doesnt work without the setTimeout function. '.next-step' is a clickable href (tabbed form)
Can you use the blur event? I.E. $('#suggest1').blur();
精彩评论