jquery-ui-autocomplete

set value to jquery autocomplete combobox

久未见 提交于 2019-11-30 12:46:21
I am using jquery autocomplete combobox and everything is ok. But I also want to set specific value through JavaScript like $("#value").val("somevalue") and it set to select element, but no changes in input element with autocomplete. Of course, I can select this input and set value directly, but is it some other ways to do that? I try set bind to this.element like this.element.bind("change", function(){alert(1)}) but it was no effects. And I don't know why. Edit I found a workaround for this case. But I don't like it. I have added the following code to _create function for ui.combobox this

Passing extra parameters to source using Jquery UI autocomplete [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 10:59:31
I'm trying to pass extra parameters for city and state using the jQuery UI autocomplete function. I've been trying to find an answer to this for a while but can't seem to find something that works for me. My current code is: $(document).ready(function () { $("#id_place").autocomplete({ source: function(request, response) { $.ajax({ url: "/autocomplete_place", dataType: "json", data: { term: request.term, city: $("id_city").val(), state: $("id_state").val(), test: 4 }, success: function(data) { response(data); } }); }, }); }); The autocomplete works, but its not passing my city and state

jquery UI autocomplete inside a modal ui dialog - suggestions not showing?

我与影子孤独终老i 提交于 2019-11-30 10:58:27
i am using the jquery ui autocomplete widget inside the jquery ui dialog. when i type in the search text, the textbox indents (ui-autocomplet-loading) but does not show any suggestions. var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"]; $("#company").autocomplete({ source : availableTags , minLength: 2 }); company is the id of the textbox to attach the autocomplete. i thought it might be a z index so i set this: .ui-autocomplete, .ui-menu, .ui-menu-item { z-index: 1006; } but it still does not show. i put

jQuery UI Autocomplete Width Not Set Correctly

流过昼夜 提交于 2019-11-30 10:22:36
问题 I have implemented a jQuery UI Autocomplete box, and rather than being the width of the textbox, the dropdown options are expanding to fill the remaining width of the page. Have a look at this example to see it for yourself: http://jsbin.com/ojoxa4 I have tried setting the width of the list immediately after creating it, like so: $('.ui-autocomplete:last').css('width', $('#currentControlID').width() ); This appears to do nothing. I have also tried setting the width using on-page styles: ui

jquery autocomplete trigger dropdown on input:focus

柔情痞子 提交于 2019-11-30 09:39:58
I'm using the popular JQuery Autocomplete plugin below. http://jqueryui.com/demos/autocomplete/ Currently if you type a phrase the drop down appears but when you click away it hides. This is fine. However the only way to bring the dropdown back is to either click in the input field and type further characters or press keydown. Any ideas on how to trigger the dropdown of results when the user clicks in the input field? I've tried to trigger the focus event for the input field but that doesn't work. I somehow need to manually call the autocomplete dropdown event when the input field is focused.

Can the default “Term” name passed in the “jquery UI autocomplete” feature be changed?

五迷三道 提交于 2019-11-30 07:35:06
I am trying to change the "term" field that is set to that by default with the jquery ui autocomplete feature. Is it possibly to easily change it to "q" (query) without going and changing it in the "core" file? JavaScript: <script> $(function() { $( "#spotify_song_search" ).autocomplete({ source: "http://ws.spotify.com/search/1/track.json", data: { q: request.term }, dataType: "getjson", minLength: 3, select: function( event, ui ) { alert('select'); } }); }); </script> Yes, it's possible by making your own AJAX request. Assume you have the following setup: $("#myfield").autocomplete({ source:

autocomplete ._renderItem and adding a Class to wrapper

天涯浪子 提交于 2019-11-30 07:31:59
问题 Going off the example here http://jqueryui.com/demos/autocomplete/#custom-data I'm wondering how to add a style to the ul wrapper when using _renderItem() : .data( "autocomplete" )._renderItem = function( ul, item ) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "<br>" + item.desc + "</a>" ) .appendTo( ul ); }; 回答1: Here would be one simple way to do it, tapping into the open event: $("#auto").autocomplete({ source: /* ... */, open: function () { $

jQuery UI autocomplete: add a css class to specific items

回眸只為那壹抹淺笑 提交于 2019-11-30 05:14:56
I am using Jquery UI's autocomplete widget and I am fetching the items to display through a callback as described in the reference. I have a use-case where I need to present some of the items that I retrieve from the server slightly differently than others, so that the user understands there is a difference between these items. In my case, some of the items are 'personal', and some are 'global'. I would like to let the 'personal' items stand out by adding a CSS class to them so that they have a slightly different background. Is this possible? I have seen in the reference documentation that an

How do you set a default value with jquery auto complete combobox?

自古美人都是妖i 提交于 2019-11-30 03:20:43
When using the jquery ui autocomplete combobox , can you set a default value for the combobox? I tried answer this in the way that I would do it in my own project. I read through the demo source code from the page you posted. In the jquery code that generates the autocomplete combobox, I added one line of code that processes when the combobox is created that reads the selected value from your "select" element. This way you can programmatically set the default value (like you would normally if you were not using the autocomplete combobox) Here is the one line I added: input.val( $("#combobox

jquery ui autocomplete _renderItem seems to interfere with select event

女生的网名这么多〃 提交于 2019-11-30 03:00:33
问题 My select event doesn't work if I use _renderItem. If I comment out the last block of code where I call _renderItem, the select event works. When I use _renderItem, the select event doesn't fire at all. var cache = {}, lastXhr; $("#hifind-find").autocomplete({ source: function(request, response) { var term = request.term; if (term in cache) { response(cache[term]); return; } var posturl = '/hifind/jquery_ui/autocomplete/'+term; lastXhr = $.post(posturl, function(data, status, xhr) { cache