I really found that a more reliable way was to bind the focus action with 'on' to trigger automatic completion depending on the class of the field and destroy it when exiting. Thus, it cleans garbage and only in it when you need it.
I used it with line cloning and even did deep cloning that would clone the plus and minus buttons for strings, this is not autocomplete cloning.
var auto_opts = {...opts...} $('body').on('focus', '.search_field', function(){ $(this).autocomplete(auto_opts).on('blur', function(){$(this).autocomplete('destroy')}); });
It also means that you are not forced to use the last line, because it works in the field when you focus on it.
crazeyez Oct 21 '16 at 1:59 2016-10-21 01:59
source share