jquery-ui-autocomplete

Cant override jQuery UI autocomplete renderItem method multiple times

被刻印的时光 ゝ 提交于 2019-12-05 22:00:58
问题 It overrides properly in the first autocomplete found, but do nothing with the rest. Instead it loads the original _renderitem method that you can see at https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js#L449. $(".someClassWithMultipleItemsOnDOM").autocomplete({ delay:500, minLength:2, source:path" ..... }).data( "autocomplete" )._renderItem = function( ul, item ) { thanks in advance 回答1: There's a workaround for this problem: var autoc = { delay: 500, minLength: 2,

jQuery UI autocomplete: how to send post data?

瘦欲@ 提交于 2019-12-05 20:39:39
问题 From jQuery UI site (veiw source): $( "#birds" ).autocomplete({ source: "search.php", minLength: 2, select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); } }); So as I see there is no options how to make ajax request with post data to the "search.php" . But I need to do that to send some filter from previous input field (current field: city , previous field: country ). How to do that? Thanks! 回答1:

JQuery UI Autocomplete - How to select an item and mantain the label (not the value) in the input text

ⅰ亾dé卋堺 提交于 2019-12-05 20:03:16
问题 I´m trying to use the JQuery UI Autocomplete plugin (click to see the demo page of JQuery UI Autocomplete plugin) I´m using as datasource a list of objects as bellow: var availableTags = [ {label: "Sao Paulo", value: "SP"}, {label: "Sorocaba", value: "SO"}, {label: "Paulinia", value: "PA"}, {label: "São Roque", value: "SR"} ]; The problem is that when I select an item, the value of the datasource is set to the input field and not the label. I´ve created a handle to the select to save the item

jQuery UI autocomplete works in Firefox but not in IE

蓝咒 提交于 2019-12-05 12:37:32
I've got the new autocomplete widget in jQuery UI 1.8rc3 working great in Firefox. It doesn't work at all in IE. Can someone help me out? HTML: <input type="text" id="ctrSearch" size="30"> <input type="hidden" id="ctrId"> Javascript: $("#ctrSearch").autocomplete({ source: "ctrSearch.do", minLength: 3, focus: function(event, ui){ $('#ctrSearch').val(ui.item.ctrLastName + ", " + ui.item.ctrFirstName); return false; }, select: function(event, ui){ $('#ctrId').val(ui.item.ctrId); return false; } }); Result (IE 8): The red box is the <ul> element created by jQuery. I also get this error: Line: 116

jqueryUI autocomplete menu show effect

好久不见. 提交于 2019-12-05 12:26:39
I spend half of a day trying to apply fade effect for autocomplete drop down menu... The final result is very uncomfortable for me - look like 'lucky shoot', not real solution. I used jqueryui default demo for example, and add lines: var acMenu = $("#tags").data().autocomplete.menu.activeMenu; acMenu._basehide = acMenu.hide; acMenu.hide = function(){ this._basehide("fade","slow"); }; acMenu._baseshow = acMenu.show; acMenu.show = function(){ this._baseshow("fade","slow"); }; The whole file looks like (© for www.jqueryui.com): <!doctype html> <html lang="en"> <head> <meta charset="utf-8" />

How to Map data in jquery-ui autocomplete is not working

流过昼夜 提交于 2019-12-05 11:52:56
i am using jquery-ui autocomplete and making a ajax call inside the autocomplete function i am calling my controller action which returns Json , but suggestions is not showing in dropdown Javascript function log(message) { $("<div>").text(message).prependTo("#log"); $("#log").scrollTop(0); } $("#search").autocomplete({ source: function (request, response) { $.ajax({ url: "/Home/GetCompanyNames", dataType: "jsonp", data: "searchterm=" + request.term, success: function (data) { response($.map(data, function (item) { alert(item.Value); return { label: item.Name, value: item.Name }; })); } }); },

“No Matches” message for jquery ui autocomplete

我怕爱的太早我们不能终老 提交于 2019-12-05 09:58:56
I'm new to this and have looked at other examples but am unclear on how to set a "No Matches" messages for the latest version of autocomplete http://docs.jquery.com/UI/Autocomplete when there are no results. This is the code I'm using, can someone help write the rest, ideally keeping it clickable to a 'suggestions' page. <script> $(document).ready(function() { var data = [ {label: 'Yahoo', value: 'http://yahoo.com'}, {label: 'BMW', value: 'http://bmw.com'}, {label: 'Bing', value: 'http://bing.com'} ]; $("input#autocomplete").autocomplete({ source: function(request, response) { var results = $

Unexpected token < in JSON at position 2 jquery Autocomplete

吃可爱长大的小学妹 提交于 2019-12-05 09:14:58
I have an AJAX request with jQuery "autocomplete", like code bellow: var clientesList = []; $("#clientes").autocomplete({ source: function (request, callback) { $.ajax({ type: "POST", url: "../../../Cliente/GetClientesByName", data: "{'nome':'" + request.term + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { debugger; callback($.map(data.cities, function (obj) { return obj.Main })) } }) } }) When the event is triggered, the error is showed in jquery.min?? "Create:2 Uncaught SyntaxError: Unexpected token < in JSON at position 2" My input HTML

How can I change the result filter in Autocomplete?

社会主义新天地 提交于 2019-12-05 08:50:13
Instead of making a literal match I'd like to select results by regular expression. Can I override Autocomplete's default behavior to accomplish this or do I need an alternate structure? There is a built-in way to do this: just provide a function for the source option in the autocomplete widget: var items = ['Foo', 'Bar', 'Hello', 'Goodbye', '1234']; $("#autocomplete").autocomplete({ source: function(request, response) { // The term the user searched for; var term = request.term; // Extract matching items: var matches = $.grep(items, function(item, index) { // Build your regex here: return /\d

jquery autocomplete special char trigger

五迷三道 提交于 2019-12-05 06:12:15
问题 i have the following problem: i must make a special autocomplete with jquery triggered by char "@" the problem is that if i begin the textbox with @ it works but if i enter @ after i write some chars it doesn't work. how it must work: -i write some text an i want to add someone from "utilizatoriJson", -to add someone from "utilizatoriJson" i must press the @ key and an autocomplete dropdown must apear, -after i select someone from dropdown or i type a full label from dropdown it must put