Is there more than one jQuery Autocomplete widget?

情到浓时终转凉″ 提交于 2019-12-19 00:23:30

问题


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:

  • jquery.autocomplete.js - how does autocomplete work?
  • Jquery AutoComplete Plugin calling
  • Help with jquery autocomplete and json response

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?


回答1:


ANSWER

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

    • There is ONLY ONE that belongs to jQuery UI. http://docs.jquery.com/UI/Autocomplete
    • There is another 3rd party user-contributed plugin that is listed on the jQuery site. This is not part of jQuery but works with jQuery. It's user-contributed.
      from jquery.com: http://docs.jquery.com/Plugins/Autocomplete
      actual home page: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
    • there are numerous others....
  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".




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/2421966/is-there-more-than-one-jquery-autocomplete-widget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!