【发布时间】:2017-10-06 20:58:23
【问题描述】:
我想在自动完成中添加多个数组。我已经添加了aTags,但是如何添加bTags?
var aTags = ["ask", "always", "all", "alright", "one", "foo", "blackberry", "tweet", "force9", "westerners", "sport"];
var bTags = ["aaaaaaa", "bbbbbbbb", "ccccccc", "ddddddddd"];
$("#tags").autocomplete({
source: aTags,
response: function(e, result) {
if (!result.content.length) {
console.log('No matches!');
jQuery('#messag').html("Not match...").show();
} else {
jQuery('#messag').hide();
}
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" />
<input type='text' title='Tags' id='tags' />
<span id="messag"></span>
【问题讨论】:
标签: jquery arrays autocomplete