Jquery autocomplete not firing on keyup unless focus changes

Posted by TheIG on Stack Overflow See other posts from Stack Overflow or by TheIG
Published on 2010-03-16T17:54:16Z Indexed on 2010/03/16 18:01 UTC
Read the original article Hit count: 556

I am using a jquery autocomplete and i have a keyup event for my textbox. When I enter in a letter the function is called but the box is not populated.

Once I click away from the box and then click back into it the autocomplete works great.

Really weird issue and I have no idea how to fix it. Any help would be appreciated.

here's my code

$(document).ready(function(){

  var x;
  var output;
  x = document.getElementById('site').value; 

  $.getJSON(url,{field: "name",value: x, comparison: "LIKE"},  
    function(json){    
      //code to format output
      $("#site").autocomplete(output, json);   
  });  
});



<input type ="text" size ="40" id="site"></input> 

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript