JQuery Autocomplete Copy Paste issue
===

I have been using Jquery Autocomplete for sometime now and just released an application that heavily uses it. Users do like the functionality but they have been reporting a bug ( application) :

"Copy & Paste in input field never works first time, if you paste it again it starts working". 

I have confirmed this behaviour. In view page I am using the following code to trigger autocomplete based on copy paste:

      $("#ID").live('paste', function (e) {
       // var el = $(this);
        setTimeout(function () {
           // var text = $(el).val();
            $('#ID').autocomplete( "search" ,$("#ID").val());
        }, 0);
    });

 and during my investigation I have noticed that autocomplete is triggered but never enters to make ajax call ( no call in XHR tab of debugger)
![screen shot][1]
If I copy & paste, second time does enter function inside "source:" ,XHR request is made and controller action gets request. 

There are no errors reported - on server side as well as client side.

It seems there is something wrong with the request parameter, first time, which makes the call exit before executing ajax call 

please advise how to resolve this issue/ any workarounds.

Thank you,

Mar

 


  [1]: http://i.stack.imgur.com/5jzPg.jpg