O'Reilly logo

jQuery UI 1.10: The User Interface Library for jQuery by Dan Wellman, Alex Libby

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying HTML in the list of suggestions

By default, the autocomplete widget will only display plain text for each suggestion in the list. Of course, this plain text is within HTML elements created by the widget, but nevertheless, if we try to use HTML within our data source, then it will be stripped out and ignored. However, Scott González, the current project leader for jQuery UI, has written an extension that allows us to use HTML for each suggestion in the list instead of plain text, if the need arises.

This could be handy if we wanted to highlight to the visitor the parts of the suggestion that matched with what they had typed in the <input> element. We will need the extension for this example, which can be found at https://github.com/scottgonzalez/jquery-ui-extensions/blob/master/src/autocomplete/jquery.ui.autocomplete.html.js ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required