How do you bind jQuery UI autocomplete using .on()?

If I understood correctly, your problem looks very similar to one I saw in another topic. I’ll adapt my answer to your case, let’s see if it solves your problem: $(document).on(“focus”,[selector],function(e) { if ( !$(this).data(“autocomplete”) ) { // If the autocomplete wasn’t called yet: $(this).autocomplete({ // call it source:[‘abc’,’ade’,’afg’] // passing some parameters }); } … Read more

JQuery AutoComplete, manually select first searched item and bind click [duplicate]

If you look at the way the jQuery team does it in their unit tests for autocomplete, they use something similar to the following code: var downKeyEvent = $.Event(“keydown”); downKeyEvent.keyCode = $.ui.keyCode.DOWN; // event for pressing “down” key var enterKeyEvent = $.Event(“keydown”); enterKeyEvent.keyCode = $.ui.keyCode.ENTER; // event for pressing “enter” key $(“#autoComplete”).val(“item”); // enter text … Read more

AutoComplete in jQuery with dynamically added elements

How about using another approach: initialize the autocomplete when you create the input: $(function() { // settings for each autocomplete var autocompleteOptions = { minLength: 3, source: function(request, response) { $.ajax({ type: “GET”, url: “getNames.html”, data: { name: request.term }, success: function(data) { response(data); } }); } }; // dynamically create an input and initialize … Read more

Sorting Autocomplete UI Results based on match location

You can provide any local filtering logic you’d like by providing the source option a function instead of a simple array. Here’s a quick example that will do the basics of what you want: var source = [‘Adam’, ‘Benjamin’, ‘Matt’, ‘Michael’, ‘Sam’, ‘Tim’]; $(“input”).autocomplete({ source: function (request, response) { var term = $.ui.autocomplete.escapeRegex(request.term) , startsWithMatcher … Read more