jQuery UI Autocomplete

0 comments

There are 2 versions of jquery autocomplete - the old and the new. Both written by same dude, Jörn Zaefferer who also wrote Validation plugin.

 

New Version

Works with JSON data source (very tricky to do plain text - see here)

Compatible with jquery 1.4

Part of jQuery UI 1.8

All methods pretty much are different from old version, so it is important to know the difference when googling for sample code

Download it from jQuery UI builder roller bullshit thing

 

Old Version

Version 1.0.2

Works with plain text data source (also json option)

Compatible with jquery 1.3

Not reliant on jQuery UI

Download it from http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

 

Migration Guide for upgrading to new version

Explains how to implement most of the old features using the new methods

http://www.learningjquery.com/2010/06/autocomplete-migration-guide

 

Update 25 July 2013 - Using jQuery UI with jQuery 1.8

 

If you upgrade to jQuery 1.8 you should also upgrade to jQuery UI  1.10.3. If you do not use the latest UI version you will get java script errors such as "Cannot set property '_renderItem' of undefined jQuery UI autocomplete with HTML.

 

Once you upgrade then you need to change a few things to make it work again. The "autocomplete" tag has now changed as below:

 

return $("<li></li>") .data("autocomplete", item) .append("") .appendTo(ul);

 

now needs to be:

 

return $("<li></li>") .data("ui-autocomplete-item", item) .append("") .appendTo(ul);

 

and

 

.data("autocomplete")._renderItem = function (ul, item) {

 

needs to be

 

.data("ui-autocomplete")._renderItem = function (ul, item) {

 

For more info see http://stackoverflow.com/questions/1414365/how-to-disable-an-input-with-jquery

 

 

 


Comments


Leave a Comment