需要在下拉选项中创建评论

时间:2018-07-09 09:20:04

标签: javascript jquery ember.js

嗨,我需要使用以下注释创建下拉选项:

enter image description here

在该Admin中是用户,一旦开始键入名称“ admin”,它们就会出现。就像所有搜索用户一样,评论需要像上面一样

这是我尝试过的代码:

$( function() {
   var availableTags = [
     "ActionScript",
     "AppleScript",
     "Asp",
     "BASIC",
     "C",
     "C++",
     "Clojure",
     "COBOL",
     "ColdFusion",
     "Python",
     "Ruby",
     "Scala",
     "Scheme"
   ];
   $( "#tags" ).autocomplete({
     source: availableTags
   });
 } );

<div class="ui-widget">
 <label for="tags">Tags: </label>
 <input id="tags">
</div>

请为此提供建议。预先感谢

1 个答案:

答案 0 :(得分:1)

$( "#tags" ).autocomplete({
     source: availableTags,
open: function () {
                if (!$('#auto').length) {
                                                $('<li id="auto">Continue typing to refine further </li>').appendTo('ul.ui-autocomplete');
                                        }
                                    }

   });

请尝试这个