jquery-ui-autocomplete

Clear text box in Jquery Autocomplete after selection

耗尽温柔 提交于 2019-12-06 16:41:11
问题 I want to clear the textbox having Jquery Autocomplete once the user has made the selection. I tried to clear the field by : select: function(event, ui) { $(this).val(''); } But this is not working.I am using jquery-1.6.4 and jquery-ui-1.8.16. Any Ideas? 回答1: The select event occurs before the field is updated. You will have to cancel the event to avoid the field being updated after you have cleared it: select: function(event, ui) { $(this).val(""); return false; } Update: As T.J. pointed out

jQuery autocomplete data undefined error

点点圈 提交于 2019-12-06 15:42:44
I am using jquery v 2.0.0 and jquery ui 1.10.3 Following is my jquery ui autocomplete code: $nameField.combobox({ source: people, buttonSelector: '.toggleList', focus: function () { return false; }, select: function (event, ui) { $nameField.val(ui.item.name).data({ id: ui.item.id, name: ui.item.name, birthdate: ui.item.birthdate }); return false; } }).data('ui-autocomplete')._renderItem = function (ul, item) { if (!_.include(self.idArr, item.id)) { return $('<li></li>').data('ui-autocomplete-item', item).append('<a>' + item.name + '</a>').appendTo(ul); } }; This was working perfectly in older

jQuery UI Autocomplete: how do you start an asynchronous process and quit it before it finishes

跟風遠走 提交于 2019-12-06 12:23:14
问题 I am using jQuery UI Autocomplete to build a search interface. I have defined a custom function which returns search results and updates them automatically as keys are pressed however, sometimes this custom function doesn't complete before the next key is pressed (i.e. its still processing "Wash" when I have already written "Washi" (on the way to writing "Washington"). I would like every call to the autocomplete "source" event to cancel the previous function(Wash) and start the new function

How to reuse jquery-ui-autocomplete cached results when appending search term?

北慕城南 提交于 2019-12-06 11:21:45
I have the following JS method to bind the jQuery UI autocomplete widget to a search text box. Everything works fine, including caching, except that I make unnecessary server calls when appending my search term because I don't reuse the just-retrieved results. For example, searching for "ab" fetches some results from the server. Typing "c" after "ab" in the search box fetches "abc" results from the server, instead of reusing the cached "ab" results and omitting ones that don't match "abc". I went down the path of manually looking up the "ab" search results, filtering them using a regex to

Does jquery UI Autocomplete support restrict typing on invalid values where supporting multiple values?

烈酒焚心 提交于 2019-12-06 07:48:25
问题 I am taking over a new website and it was using an old deprecated version of the jquery autocomplete plugin. I am trying to recreate the functionality using the latest jquery ui autocomplete and there is one feature that i can't seem to replicate. I am trying to replicate the "mustMatch" functionality in cases where there are multiple values allows. so basically, if i start typing any test that doesn't show up in any of the search results (even partial string search), it resets the entry for

Modify the behavior of jquery tag-it based on autocomplete library to use ajax JSON sources

人盡茶涼 提交于 2019-12-06 06:14:09
问题 I'm trying to add some functionality to jQuery plugin tag-it based on auto-complete : a) I try to filtering my JSON data to display only name of tag. A JSON sample returned by /repo/json : [{id:1, name:"0.8-alpha-1", category:"version"}, {id:2, name:"0.8-alpha-2", category:"version"}, {id:3, name:"0.8-alpha-3", category:"version"}, {id:4, name:"0.8-alpha-4", category:"version"}, {id:5, name:"0.8-alpha-1", category:"version"}, {id:6, name:"0.8-alpha-2", category:"version"}, {id:7, name:"0.8

How to make jQuery autocomplete list display all options onfocus and hide after option is selected?

那年仲夏 提交于 2019-12-06 06:11:24
问题 I have a form with an autocomplete that starts the search "onfocus" and shows the option list when the user clicks into the search field, even when they do not enter anything. The problem is the autocomplete requires the option to be selected with either the keyboard (down arrow followed by tab/return or with a double click). My first thought was that a single click causes the focus to remain in the search field, and thus the autocomplete to stay visible. However, the search field remains

How To: Modify jquery.autocomplete regex to show results that starts with the given input

扶醉桌前 提交于 2019-12-06 05:31:31
问题 I dont know enough to modify following code that will show me the word starting with the inputted characters.For eg.: If I type E or e it shows me "Electrical,Electronics,Mechanical" but I want only "Electrical,Electronics" to be displayed.How to do this? I am using jquery autocomplete plugin. source: function(request, response) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response(select.children("option").map(function() { var text = $(this).text(); if (this

Autocomplete experimental messages option, no results

回眸只為那壹抹淺笑 提交于 2019-12-06 04:22:20
I moved to jQuery UI 1.9 and have some problems with Autocomplete control. As written here they added option called messages that actually shows "No results" or results count information under the control. The problem that I can't any info about its behaviour find in the manuals . How can I disable that option? Thank you Indeed not in the API documentation to the date of my answer... You can customize it this way: jQuery(...).autocomplete({ messages : { noResults : 'No results found.', results : function(count) { return count + (count > 1 ? ' results' : ' result ') + ' found'; } }, }); NOTE:

jQuery UI autocomplete show results before search

我的未来我决定 提交于 2019-12-06 04:20:25
I want in my project to show some first results before I focus autocomplete input. Those results should work the same way as results of autocomplete ajax request. Can I do this by standart options of autocomplete or I should write equal javascript code? You should set the minLength option to 0 . If you want results to appear as soon as the field is focused into, you could write a simple event handler to accomplish that: $("input").autocomplete({ source: /* source */, minLength: 0 }).on("focus", function () { $(this).autocomplete("search", ''); }); Example: http://jsfiddle.net/mLSjL/ Edit: If