var projects = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
var $project = $("#tags");
$project.autocomplete({
minLength: 1,
source: projects,
focus: function(event, ui) {
$project.val(ui.item.label);
return false;
},
close: function (e, ui) {
e.target.value = '';
//createTag(ui.item.label, ui.item.id);
}
});
<link href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
嗨,在'選擇內的地方:功能(E,UI){ .....}'會訣竅 – Sasikumar
嗨,我試過它沒有工作! – Tony