Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#5216 closed enhancement (invalid)

[autocomplete] Added support for "no results found" text.

Reported by: dmillz Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi,

I've been working with the very handy jQuery autocomplete plugin, and I added a small bit of functionality that I thought you may be interested in adding to the official release. I added a callback for when there are no results found that match the typed text. The user can specify the text to display by returning a value from the callback, and the callback itself is specified as a parameter to the .autocomplete() call. For example:

$("#textbox").autocomplete("someAjaxPage", {

width: 320, max: 100, notFound: function(term) {

return "No items were found starting with \"" + term + "\"";

}

});

I've attached the modified jquery.autocomplete.js for your perusal. I'm relatively new to working with jQuery, so any feedback you have is appreciated. The mod works nicely for my purposes, but hasn't yet been tested with all configurations.

I appreciate all the work that's gone into this plugin, and I hope my modification is useful!

Regards,

David Mills

Attachments (1)

jquery.autocomplete.modified.js (30.1 KB) - added by dmillz 10 years ago.
jQuery autocomplete plugin modified for "not found" text support

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by dmillz

jQuery autocomplete plugin modified for "not found" text support

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

This is not a jQuery core bug. Please use the jQuery forums or contact the author via the method they request. For jQuery UI plugins, please file a bug on http://dev.jqueryui.com .

comment:2 Changed 7 years ago by grisboreal@…

Hello,

i want to use a link along with the "no results" text, but the link is not going anywhere.

Example with hmtl markup: "no results match your query. <a href="somepage.html">Search all instead</a>"

I presume it´s because the "no results" item is selectable by the autocomplete plugin and is overriding my custom href location.

Can you help me ?

Thanks

Note: See TracTickets for help on using tickets.