Can jQuery widget user interface autocomplete work with delegate on clones?

I'm trying to get autocomplete to work with clones using a delegate, but it doesn't seem to work in Google Chrome.

Here is my attempt: http://jsfiddle.net/uGdm2/

Any ideas?

Thank.

+3
source share
1 answer

Try again:

var tags = ["PHP", "Perl", "Python"];
$('body').delegate('input.tags', 'focusin', function() {
    if($(this).is(':data(autocomplete)')) return;
    $(this).autocomplete({
        "source": tags
    });
});
var tagsdiv = $('#tags');
$('body').delegate('a.copy', 'click', function(e) {
    e.preventDefault();
    $(this).closest('div').clone().appendTo(tagsdiv);
});

http://jsfiddle.net/petersendidit/uGdm2/4/

+3
source

Source: https://habr.com/ru/post/1788883/


All Articles