是否有多个 jQuery 自动完成小部件?

发布于 2024-08-24 12:15:30 字数 1774 浏览 1 评论 0 原文

我以为只有一个 - 包含在 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 自动完成吗?

I thought there was only one - included in jQuery UI and documented here.

I know there are third-party autocomplete widgets that plug-in to jQuery, like the one from devbridge. But I would describe that as an autocomplete widget for jQuery, rather than the jQuery autocomplete widget.

But on Stackoverflow, I see questions asking about an autocomplete widget that does not use the syntax described in the jQuery UI documentation. For example:

The jQuery UI syntax looks like this:

      $("#input1").autocomplete({
          source: function(req, responseFn) {
                ...
          },

          select: function(value, data){
                 ...
          }
      });

Whereas some of those other questions hae a syntax like this:

  $("#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 
  });  

What's the explanation for the discrepancy? People ask about "jquery autocomplete" without specifying which one. With no direction, shouldn't I assume THE jquery UI autocomplete?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

归途 2024-08-31 12:15:30

答案

  1. 有许多可与 jQuery 配合使用的自动完成小部件。

  2. jquery 插件的用户有一个相当普遍的习惯,当询问有关 SO 的问题时,不知道他们正在使用哪个特定的小部件。当人们真正指的是“a jquery 自动完成小部件”时,他们会使用“the jquery autocomplete widget”之类的短语。

ANSWER

  1. There are numerous autocomplete widgets that work with jQuery.

  2. 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".

小帐篷 2024-08-31 12:15:30

Google 搜索揭示了许多不同的 jQuery 自动完成插件,包括 命名 jQuery 自动完成

A Google search reveals many different jQuery autocomplete plugins, including four named jQuery autocomplete.

扶醉桌前 2024-08-31 12:15:30

有许多。我什至知道有人劫持了 StackOverflow 上的 jquery-autocomplete 标签。直接来自支持页面

如果你想使用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:

If you want to use jquery-autocomplete, you may have some questions. We suggest you ask your questions on StackOverflow, and use the jquery-autocomplete tag to identify them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文