I'm using multiple (100+) autocomplete fields on the same page, all with the same data source, and have noticed that the initialization of the autocomplete fields is a bit slow. From some profiling I've done it looks like the bottleneck is the creation of the menu (this.menu = $( "<ul></ul>" )
and so forth in the source code).
It seems kind of unnecessary to create separate menues for each aut开发者_开发问答ocomplete field, and so I was wondering if someone knows of a way to make this initialization faster.
I was thinking of making jQuery UI just use the same menu (or preferably the same autocomplete object) on all the input fields, but I don't know how this could be done without modifying the plugin source code.
You can try only initializing the autocomplete field when the user clicks the field
I had the same problem and fixed it by initialise auto-complete on focus:
$(".complete").focus(function(){
$(this).autocomplete({
//your options
});
});
The field with auto-complete function needs the class "complete" off course.
精彩评论