开发者

jquery autocomplete remove focus after suggest

开发者 https://www.devze.com 2023-03-01 09:48 出处:网络
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

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();

0

精彩评论

暂无评论...
验证码 换一张
取 消