1

如何专注于创建的自动完成菜单项:

 <ul id="ui-id-1" class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" tabindex="0" ...>
    <li class="ui-menu-item" role="presentation">
<a id="ui-id-3" class="ui-corner-all" tabindex="-1">ONE</a>
    <li class="ui-menu-item" role="presentation">
<a id="ui-id-4" class="ui-corner-all" tabindex="-1">TWO</a>
<...>

我试过$('#ui-id-3').focus();

没有效果。一般来说,我的意思是自定义自动完成: https ://forum.jquery.com/viewImage.do?fileId=14737000004279180&forumGroupId=14737000000003003

4

1 回答 1

1

Try this code:

$("#autocomplete").autocomplete({
    source: [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
        "Groovy",
        "Haskell",
        "Java",
        "JavaScript",
        "Lisp",
        "Perl",
        "PHP",
        "Python",
        "Ruby",
        "Scala",
        "Scheme"
    ],
    autoFocus: true 
});

http://jsfiddle.net/Bqujj/91/

于 2013-06-26T10:46:43.247 回答