jQuery autocomplete plugin not working
I'm using jQuery Autocomplete plugin 1.1 now, not the one included in jQuery UI. I found that in some cases my browser will go dead. For example, when I typed in a character 'a' and there are 2 items displayed correc开发者_运维问答tly. Then I type in another charactor 'z'. This time there is no matched items, but the drop-down tip does not hide, at the same time the browser lose responsing. I wonder whether my code has any problem. Following are parts of my code.
parse: function(data){
var rows = [];
for (var i = 0; i < max_item; i++) {
rows[rows.length] = {
data: items[i],
value: items[i].fields.name,
result: items[i].fields.name
}
}
return rows;
},
formatItem: function(item){
return 'balabala';
}
...
I would recommend upgrading to the jquery ui autocomplete plugin. http://jqueryui.com/demos/autocomplete/
I just used it on a project, and it works great.
I don't know what the rest of your code is. but make sure you're not calling the parse function more than once...It could certainly slow down your browser
精彩评论