Jquery autocomplete does not work when TextBox control is focused on PageLoad.
Is this a know issue, or is there a way to fix this problem?
Thanks
<head>
<script type="text/javascript">
$(document).ready(function() {
    $("#<%=txtSearchTerm.ClientID%>").autocomplete("Acc.ashx", {
        scroll: true, max: 30, selectFirst: true,
        formatItem: function(item) { return item.toString().split("#")[0]; },
        formatResult: function(item) { return item.toString().split("#")[0]; }
    });
    $("#<%=txtSearchTerm.ClientID %>").result( function findValueCallback(event, data, formatted)
    {
        if(data)
开发者_C百科        {
            $('#<%=hidOID.ClientID %>').val(data[0].toString().split('#')[1]);
            $('#<%=butSearch.ClientID %>').attr("disabled", false);
        }   
        else
        {
        $('#<%=butSearch.ClientID %>').attr("disabled", true);
        }         
    });
    });
    </script>
</head>
/body>
</html>
<script>
$(document).ready(function() {
$('#txtSearchTerm').focus();
});
</script>
I also faced the same problem as "Jquery autocomplete not firing on keyup unless focus changes" and to fix the issue, I followed the $('#selector').focus(); suggestion provided by Val and it worked for me. Here is my change 
$('#inputBox').autocomplete(data);          
$('#inputBox').focus(); 
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论