jquery-ui-autocomplete

Is it possible to set the width of a jQuery autocomplete combobox?

霸气de小男生 提交于 2019-11-30 02:55:46
I am using this jQuery UI combobox autocomplete control out of the box off the jQuery UI website: My issue is that I have multiple comboboxes on a page, and I want them to have different widths for each one. I can change the width for ALL of them by adding this CSS: .ui-autocomplete-input { width: 300px; } but I can't figure out a way to change the width on just one of them. Mark A simple $('.ui-autocomplete-input').css('width','300px') works (I tried it on the linked page with Firebug ) to change the first one on the page. You can do something like: $($('.ui-autocomplete-input')[N]).css(

Jquery autocomplete - custom html for result listing

心不动则不痛 提交于 2019-11-30 00:06:22
I am referring to this plugin: http://jqueryui.com/demos/autocomplete/ So the original structure for the results is <ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all"> <li class="ui-menu-item"> <a class="ui-corner-all">item 1</a> </li> <li class="ui-menu-item"> <a class="ui-corner-all">item 2</a> </li> <li class="ui-menu-item"> <a class="ui-corner-all">item 3</a> </li> </ul> I need to make the links inside to look something like this: <a class="myclass" customattribute="something"> The item </a> Please don't tell me the only solution it to edit the plugin because i

How to suggest similar words in autocomplete

大憨熊 提交于 2019-11-29 23:35:40
问题 I have an input field for locations with jquery-ui-autocomplete. <script type="text/javascript"> $(document).ready(function(){ var location_input=$('input[id="location-autocomplete"]'); var cityNames = [ { value: 'Mallorca' }, { value: 'Berlin' }, { value: 'London' }, // many other elements ]; location_input.autocomplete({ source: cityNames, minLength: 2 }); } ); // keeps same width as box jQuery.ui.autocomplete.prototype._resizeMenu = function () { var ul = this.menu.element; ul.outerWidth

jQuery ui autocomplete when user does not select an option from the dropdown

 ̄綄美尐妖づ 提交于 2019-11-29 21:06:47
When using the jquery autocomplete plugin , what do you do when the user does not select an item in the list, but instead types a valid value and tabs away? eg when the auto complete list contains: Cat Dog Fish And the user types cat , but does not select Cat from the autocomplete's dropdown list and instead tabs away. Because they did not select any item from the list, the autocomplete select event does not fire, and we lose the chance to respond to it: $('#Animal').autocomplete({ source: url, minlength: 1, select: function (event, ui) { $("#Animal").val(ui.item.value); changeUsersAnimal(ui

jQuery UI Autocomplete Width Not Set Correctly

时光毁灭记忆、已成空白 提交于 2019-11-29 20:07:31
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-autocomplete { width: 500px; } This DOES work, amazingly, however it would mean that all autocompletes on

How to get jQuery dropdown value onchange event

你离开我真会死。 提交于 2019-11-29 19:41:23
I have added two jQuery UI Dropdown Autocomplete script. Now I want get both value onchange of second dropdown and want to store separately in variable. How it is possible? Any ideas or suggestions? Thanks. My Fiddle: Sample My JS Code: (function($) { $.widget("ui.combobox", { _create: function() { var self = this, select = this.element.hide(), selected = select.children(":selected"), value = selected.val() ? selected.text() : ""; var input = this.input = $("<input>").insertAfter(select).val(value).autocomplete({ delay: 0, minLength: 0, source: function(request, response) { var matcher = new

set value to jquery autocomplete combobox

无人久伴 提交于 2019-11-29 18:24:22
问题 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

Is it possible to capture keydown globally on dynamically added text inputs?

☆樱花仙子☆ 提交于 2019-11-29 18:05:27
I'm using the following global jQuery to show and hide a loading div for $.ajax calls: $(document).ajaxStart(function(){ $("#loading").show(); } $(document).ajaxStop(function(){ $("#loading").hide(); } This works fine, but I do not want to show the loading div for autocompletes, so I added this: $("input[type=text]").keydown(function(){ if($(this).hasClass('ui-autocomplete-input')) { window.suppressGlobal = true; } }); Then, to reset suppressGlobal for "normal" $.ajax calls, this: var origAjax = $.ajax; $.ajax = function() { if (window.suppressGlobal) { arguments[0].global = false; } origAjax

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

假如想象 提交于 2019-11-29 16:20:28
问题 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

jquery autocomplete trigger dropdown on input:focus

喜欢而已 提交于 2019-11-29 14:22:55
问题 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