Skip to content

Instantly share code, notes, and snippets.

@DBasic
Created March 14, 2014 11:00
Show Gist options
  • Select an option

  • Save DBasic/9545690 to your computer and use it in GitHub Desktop.

Select an option

Save DBasic/9545690 to your computer and use it in GitHub Desktop.
jQuery UI Autocomplete _renderItem usage.
$("#some_id")
.autocomplete({
...
}).data("ui-autocomplete")._renderItem = function (ul, item) { ... };
If you want to create the _renderItem function for multiple autocompletes with id #some_id just use it in the create event:
$('#some_id').autocomplete({
create: function() {
$(this).data('ui-autocomplete')._renderItem = function (ul, item) { ... };
}
});
@gmansilla

Copy link
Copy Markdown

thanks.

@mrmnmly

mrmnmly commented Mar 3, 2015

Copy link
Copy Markdown

If I'm trying to get some data from remote resource then how I can put its (object) attributes inside _renderItem function?

@wonderer007

Copy link
Copy Markdown

Thanks it works for me

@yusetc

yusetc commented Mar 13, 2017

Copy link
Copy Markdown

Thanks a lot, a definitive solution for remote data source and multiple autocompletes!!

@misarji

misarji commented Feb 5, 2018

Copy link
Copy Markdown

It works for multiple instances on same page, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment