Extensible Autocomplete

Posted on by

The release of the Autocomplete widget in jQuery UI 1.8 was a pretty important milestone for the jQuery UI team. If you’ve looked at the widget, you may have noticed that there are only four options, far fewer than our other plugins. Unlike progressbar, our plugin with the fewest options, Autocomplete’s small API isn’t a direct result of the plugin’s simplicity. In fact, Autocomplete is quite complex.

When designing the Autocomplete widget, we started with Jörn Zaefferer’s Autocomplete plugin, which has 21 options, as a model. Admittedly, Jörn’s plugin does more for you out of the box than ours, but our smaller API is just as flexible and has the bonus of being easier to learn and use. A lot of thought, discussion, and prototyping went into narrowing down the list of 21 options to 4.

Out of the box, Autocomplete provides support for local data sources and remote (JSON) data sources by simply providing an array or url to the source option. Support for JSONP, XML, and caching can all be layered on top in just a few lines of code.

There’s also a set of extensions hosted by me that provide additional options for the Autocomplete widget. The html option (demo) allows you to specify whether your labels should be interpreted as HTML or text. There’s also the selectFirst option (demo) which automatically activates the first item when the menu is shown, reducing the number of keystrokes necessary to select an option. The autoSelect option (demo) allows a user to type out a valid option and tab away from the field without having to select the item from the menu. If the value entered by the user is valid, the select event will be triggered just as if the user had explicitly chosen the item from the menu. I also have an accent folding extension (demo) that makes it easier for users to select values with accented characters. For example, if there is an item with the text “Jörn”, the user would normally have to type the umlaut in order to see the item. However, if the accent folding extension is loaded, the user can type “Jorn” and they will still see the result.

Going a step further, you can use custom data formats and define custom displays. For example, you can categorize the results or display additional information such as item descriptions and images. There’s even an example of expandable search results (Note: this is just a prototype based on a demo from Roman Chyla, it is not full-featured. See the forum thread for more details). You can even support multiple words from a single text field.

Finally, there’s the combobox demo that brings Autocomplete functionality to select elements. The combobox hides the select element and instead displays a text field for the user to type in. The possible values are determined by parsing the options from the select, and the user can view all options by clicking a button next to the text field. For a detailed explanation of how the combobox works, check out Jörn’s article on Learning jQuery.

The jQuery Project is Proud to Announce the jQuery Mobile Project

Posted on by

Mobile web development is an emerging hot topic in the web development community. As such, the jQuery Team has been hard at work on determining the strategy and direction that the jQuery Project will take. Today, we are proud to announce the jQuery Mobile Project. We’ve launched a new site at jquerymobile.com that publicly outlines our strategy, research and UI designs.

As always, we want to hear from you.  We’ve created a new Mobile jQuery forum to collect feedback from the community.  Please feel free to join in on the discussion and read more in the announcement.

jQuery UI 1.8.4

Posted on by

The fourth maintenance release for jQuery UI 1.8 is out. This update brings bug fixes for the Droppable, Resizable, Selectable and Sortable interactions as well as the Accordion, Autocomplete, Button, Datepicker Dialog, Progressbar, Slider and Tabs widgets. jQuery UI 1.8.3 was released a few days prior to 1.8.4, but there was a problem with the build system that caused some of the files to not contain any copyright information. If you noticed the 1.8.3 release and upgraded, please upgrade to 1.8.4. For the full list of changes, see the changelog. You can download it here:


File Downloads

Svn (contains final files as they are in the zip, with @VERSION replaced with 1.8.4, all themes)

Git (contains pre-build files, with @VERSION not yet replaced with 1.8.4, base theme only)

Google Ajax Libraries API (CDN)

Custom Download Builder

New Features

In this release, we’ve added four new methods to help with setting the dimensions of elements (actually, we’ve modified existing functions from jQuery core). .innerHeight(), .innerWidth(), .outerHeight(), and .outerWidth() can now be used as setters. They all accept a number as a parameter, and that number will be used to set the width or height appropriately, based on the padding, border, and margins (depending on the method).


You can now pass multiple events to accordion’s event option. See the hover intent demo to see an example of an accordion reacting to both clicks and hovers.


Two new options have been added to autocomplete: position and appendTo. The position option allows you to take advantage of the position utility to customize where the menu will be displayed. The appendTo option allows you to specify which element the menu will be appended to, defaulting to the body.


The dialog plugin has also been updated to allow full usage of the position utility. Setting the dialog’s position with a string or array is still possible, but will be removed in a future version.


The tabs plugin has been updated to allow accessing tabs by href in addition to index. The enable, disable, select, load, and remove methods all accept the href of a tab.


See the 1.8.4 Upgrade Guide for a list of changes that may affect you when upgrading from 1.8.2. For full details on what’s included in this release see the 1.8.4 Changelog.


Thanks to all who helped with this release, specifically: adw, afcapel, afmenez, ajcrews, ajpiano, Alberto Fernández Capel, ALLPRO, Ascold, AzaToth, bamccaig, banacan, Ben Blank, Ben Hollis, bostanio, botio, brazilianjoe, Carl Fürstenberg, charlesboyung, chromial, chungwu, Cloudream, david.long03, davidcroda, DayBay, dcramer, Diego, dmuir, dsdsico, dwreck, eduardo, ehynds, erikrose, eXtreme, floepi, francois, gavimobile, ggp, gwk, hhillen, hiszpan, Holger, Holger Rüprich, ilyasahmad, IYS, james, jawsper, jdsharp, jghermsen, joern.zaefferer, johnk_c4b, Jon Palmer, jquery-dev, JustinMacCarthy, kaito, keturn, Kevin Dalman, kingjeffrey, klaus.hartl, kobrigo, lambacck, LynXor, mathewpeterson, mgurley, mijobe, Mikko Rantanen, mnoland, mofle, mormegil, mvermilion, nbid, Nick_Craver, nmaves, nminale, paul, Pavel, redjag, RedNinja, remoteportal, Rich2k, Richard D. Worth, rtimmermans, Rwhitbeck, sam.enspiral, Samuel Cormier-Iijima, sarahinthelakes, sciyoshi, Scott González, scottjehl, Sebmaster, serhii, sleyhane, smiller.health, spudly, swago, talmdal, theojapa, Tiago Freire, triblondon, tt0shk0, tzkuei, usd2, vanboom, venky, wouter, ZeekDaGeek, Ziling Zhao.