Is it possible to include the jQuery Autocomplete plugin in "paste"?

I have a jQuery autocomplete plugin and when I copy / paste into it, it does not start. Any way to make it work?

+6
source share
4 answers
$('#ID').bind('paste', function(e) { setTimeout(function() { $('#ID').trigger('autocomplete');}, 0); }); 
+8
source
 $("#ID").bind("paste", function () { setTimeout(function () { $("#ID").autocomplete("search", $("#ID").val()); }, 0); }); 
+12
source

In order to make this work, I need to bind a keydown event. This caused a field change and completion of autocomplete.

 $('#ID').bind('paste', function() { setTimeout(function() {$('#ID').trigger('keydown');}, 100); }); 
0
source
 $('#ID').bind('input propertychange'), function(){ //do what you want here }); 
0
source

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


All Articles