是否有多个 jQuery 自动完成小部件?
我以为只有一个 - 包含在 jQuery UI 中并且记录在此处。
我知道有第三方自动完成小部件可以插入 jQuery,例如 来自 devbridge 的小部件。但我会将其描述为jQuery 自动完成小部件,而不是jQuery 自动完成小部件。
但在 Stackoverflow 上,我看到有关自动完成小部件的问题,该小部件不使用 jQuery UI 文档中描述的语法< /a>.例如:
jQuery UI 语法如下所示:
$("#input1").autocomplete({
source: function(req, responseFn) {
...
},
select: function(value, data){
...
}
});
而其他一些问题的语法如下:
$("#city").autocomplete("CUList.asmx/GetCUList", {
dataType: 'jsonp',
parse: function(data)
{
var rows = new Array();
for(var i=0; i<data.length; i++){
rows[i] = { data:data[i], value:data[i].CUName, result:data[i].CUName };
}
return rows;
},
formatItem: function(row, i, n) {
return row.CUName + ', ' + row.CUCity;
},
max: 50
});
解释是什么为了差异?人们询问“jquery 自动完成”时没有指定是哪一个。没有方向,我不应该假设 jquery UI 自动完成吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
答案
有许多可与 jQuery 配合使用的自动完成小部件。
来自 jquery.com: http://docs.jquery.com/Plugins/Autocomplete
实际主页: http://bassistance.de/jquery-plugins/jquery-plugin-自动完成/
jquery 插件的用户有一个相当普遍的习惯,当询问有关 SO 的问题时,不知道他们正在使用哪个特定的小部件。当人们真正指的是“a jquery 自动完成小部件”时,他们会使用“the jquery autocomplete widget”之类的短语。
ANSWER
There are numerous autocomplete widgets that work with jQuery.
from jquery.com: http://docs.jquery.com/Plugins/Autocomplete
actual home page: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
There is a habit that is fairly common among users of jquery plugins, when asking questions on SO, to not identify which particular widget they are using. People use phrases like "the jquery autocomplete widget" when they really are referring to "a jquery autocomplete widget".
Google 搜索揭示了许多不同的 jQuery 自动完成插件,包括 四 命名 jQuery 自动完成。
A Google search reveals many different jQuery autocomplete plugins, including four named jQuery autocomplete.
有许多。我什至知道有人劫持了 StackOverflow 上的
jquery-autocomplete
标签。直接来自支持页面:There are many. I even know of one that has hijacked the
jquery-autocomplete
tag on StackOverflow. Direct from the support page: