Javascript 为什么我无法从自动完成列表中选择数据?

Javascript 为什么我无法从自动完成列表中选择数据?,javascript,jquery,autocomplete,Javascript,Jquery,Autocomplete,我正在调用jquery自动完成函数中的javascript函数。但是调用该函数后,我无法从自动完成列表中选择数据 javascript函数基于自动完成函数填充其他字段中的数据: function info() { var txtAddresstext = document.getElementById(txtAddress); var ss = document.getElementById(hdnInfo); var ddlInfoLocation = document.getEl

我正在调用jquery自动完成函数中的javascript函数。但是调用该函数后,我无法从自动完成列表中选择数据

javascript函数基于自动完成函数填充其他字段中的数据:

 function info() {

var txtAddresstext = document.getElementById(txtAddress);   
var ss = document.getElementById(hdnInfo); 
var ddlInfoLocation = document.getElementById(ddlrInfoLoc);
 var str = ss.value;
var arr = str.split("~"); 
for (var i = 0; i < arr.length; i++) {

    txt.text = arr[10];       
   ddlInfoLocation.selectedIndex = 0;      
   ddlInfoLocation.options[0].text = arr[0];           
   txtAddresstext.value = arr[4];
   txtAddresstext.value=txtAddresstext.value.replace('undefined', '');      


}

}
<script type="text/javascript">

    function Origin(sender, args) {

        $(function () {
            $("#<%=txtInfo.ClientID %>").autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: '<%=ResolveUrl("~/Webservice.asmx/Get") %>',
                        data: "{ 'prefix': '" + request.term + "'}",
                        dataType: "json",
                        type: "POST",
                        async: false,
                        mustMatch: true,
                        contentType: "application/json; charset=utf-8",
                        success: function (data) {
                            response($.map(data.d, function (item) {
                                return {
                                    label: item.split('-')[0],
                                    val: item.split('-')[1]
                                }
                            }))
                        },
                        error: function (response) {

                        },
                        failure: function (response) {

                        }
                    });
                },

                select: function (e, i) {

                    $("#<%=hdnInfo.ClientID %>").val(i.item.val);

                    info1()                     

                },                    
                minLength: 0
            }).bind('focus', function () { $(this).autocomplete("search"); });              

            });
    }       

</script>
我的自动完成功能:

 function info() {

var txtAddresstext = document.getElementById(txtAddress);   
var ss = document.getElementById(hdnInfo); 
var ddlInfoLocation = document.getElementById(ddlrInfoLoc);
 var str = ss.value;
var arr = str.split("~"); 
for (var i = 0; i < arr.length; i++) {

    txt.text = arr[10];       
   ddlInfoLocation.selectedIndex = 0;      
   ddlInfoLocation.options[0].text = arr[0];           
   txtAddresstext.value = arr[4];
   txtAddresstext.value=txtAddresstext.value.replace('undefined', '');      


}

}
<script type="text/javascript">

    function Origin(sender, args) {

        $(function () {
            $("#<%=txtInfo.ClientID %>").autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: '<%=ResolveUrl("~/Webservice.asmx/Get") %>',
                        data: "{ 'prefix': '" + request.term + "'}",
                        dataType: "json",
                        type: "POST",
                        async: false,
                        mustMatch: true,
                        contentType: "application/json; charset=utf-8",
                        success: function (data) {
                            response($.map(data.d, function (item) {
                                return {
                                    label: item.split('-')[0],
                                    val: item.split('-')[1]
                                }
                            }))
                        },
                        error: function (response) {

                        },
                        failure: function (response) {

                        }
                    });
                },

                select: function (e, i) {

                    $("#<%=hdnInfo.ClientID %>").val(i.item.val);

                    info1()                     

                },                    
                minLength: 0
            }).bind('focus', function () { $(this).autocomplete("search"); });              

            });
    }       

</script>

参考这个。代码中可能存在js冲突。