帮助处理 jQuery 自动完成结果?
我需要拆分 自动完成插件 的字符串结果。我知道如何分割字符串以及不知道如何分割字符串,但不知道如何在插件的上下文中执行此操作。这是我到目前为止所拥有的。任何帮助将不胜感激:
<script type="text/javascript">
$(document).ready(function() {
$('.divAutoComplete').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true });
});
</script>
编辑:我已将其更改如下,现在 Firebug 对我咆哮,说“value.replace 不是函数”(错误位于插件脚本中)。不确定我做错了什么:
<script type="text/javascript">
$(document).ready(function() {
$('.divAutoComplete').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true, formatItem: formatItem });
});
function formatItem(row) {
var a = row[0].toString().split('--');
return a;
}
I need to split the string result of the autocomplete plugin. I know how to split the string and what not, but don't know how to do it in context of the plugin. Here is what I have thus far. Any help would be greatly appreciated:
<script type="text/javascript">
$(document).ready(function() {
$('.divAutoComplete').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true });
});
</script>
EDIT: I have changed it as follows and now Firebug is barking at me, saying that "value.replace is not a function" (the error is in the plugin script). Not sure what I'm doing wrong:
<script type="text/javascript">
$(document).ready(function() {
$('.divAutoComplete').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true, formatItem: formatItem });
});
function formatItem(row) {
var a = row[0].toString().split('--');
return a;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我就是这样做的:
HTH
This is how I did it:
HTH
在我的实例中,我尝试在列表项而不是输入元素上使用自动完成功能。
In my instance, I was trying to use autocomplete on a list item instead of an input element.