jquery 自动完成:适用于第一个值,如何为下一个值启用它?
我正在使用自动完成功能,因此用户可以轻松地在输入中输入数据,如下所示:
<?
$a = new etiqueta(0, '');
$b = $a->autocomplete_etiquetas();
?>
<script type="text/javascript">
function cargar_autocomplete_etiquetas(){
$("#tags").autocomplete({
source: [<? echo $b; ?>]
});
}
</script>
$a = $b 它是一个 array ,结果如下:'help','please ',我','需要','能够','选择下一个项目','自动完成';
我检查了 ui 文档,但它不符合我的源方法..有什么想法吗? 我正在尝试这样(用 Bugai13 aportation 编辑):
<?
$a = new etiqueta(0, '');
$b = $a->autocomplete_etiquetas();
?>
<script type="text/javascript">
function cargar_autocomplete_etiquetas(){
$("#tags").autocomplete({
source: [<? echo $b; ?>],
multiple: true,
multipleSeparator: ", ",
matchContains: true
});
}
</script>
但我不知道该怎么做..有什么想法吗? .push 和 .pop 函数来自自动完成功能吗?或者我应该定义他们?
再次感谢!
PS:我对这个网站越来越上瘾了! PS:来吧伙计们,我认为答案对很多人来说都是非常有用的 PS:可以提供paypal奖励吗?
I'm using autocomplete so user can easly enter data on inputs, like this:
<?
$a = new etiqueta(0, '');
$b = $a->autocomplete_etiquetas();
?>
<script type="text/javascript">
function cargar_autocomplete_etiquetas(){
$("#tags").autocomplete({
source: [<? echo $b; ?>]
});
}
</script>
$a = $b its an array with a result like: 'help','please',i','need','to,'be able to', 'select next item',' with autocomplete';
and i checked the ui documentation, but it doesn't fith with my source method.. any idea?
I'm trying like this (edited with Bugai13 aportation):
<?
$a = new etiqueta(0, '');
$b = $a->autocomplete_etiquetas();
?>
<script type="text/javascript">
function cargar_autocomplete_etiquetas(){
$("#tags").autocomplete({
source: [<? echo $b; ?>],
multiple: true,
multipleSeparator: ", ",
matchContains: true
});
}
</script>
but i don't know how to do it.. any idea? are .push and .pop functions from the autocomplete? or shall i define, them?
thanks again!
PS: i'm getting adicted to this site!
PS: come on dudes, i think the answer will be very usefull for many people
PS: is it allowed to offer paypal reward?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用以下方法来为带有“,”分隔符的标签进行多个自动完成工作,希望这对您有帮助:
我的代码完全可以工作。在我的例子中,在解析函数项中它只是 json 数组,尝试添加解析方法:
所以,你需要这样的东西:
I've use following to get work multiple autocomplete for tags with ',' separator, hope this help your:
It's full my code that work. In my case in parse function items it just json array, try to add parse method:
So, you need something like this:
echo $b;
打印什么?我希望您需要类似echo implode(',', $b)
的东西,甚至是echo '"' . implode('", "', $b) . '" ';
为了使这个工作正常,如果 $b 确实是一个 PHP 数组。编辑:(当然,我只是假设您使用的是 PHP,但如果它
像 PHP 并且
$
像 PHP...)What does
echo $b;
print? I would expect you would need something likeecho implode(',', $b)
, or evenecho '"' . implode('", "', $b) . '"';
to make this work, if $b really is a PHP array.Edit: (of course I'm only assuming you're using PHP, but if it
<?
s like PHP and$
s like PHP...)