Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery将自动完成结果显示在其他输入元素上_Jquery_Css_Autocomplete - Fatal编程技术网

jquery将自动完成结果显示在其他输入元素上

jquery将自动完成结果显示在其他输入元素上,jquery,css,autocomplete,Jquery,Css,Autocomplete,在输入框上使用jquery自动完成。这是工作100%,但认为造型需要一些工作 目前,jquery建议显示在其他输入元素的文本后面。如果单击选择框下方的jquery选项,则会触发选择框,而不是选择自动完成选项 如何将jquery自动完成配置为顶部?这是js问题还是css问题 我尝试使用以下代码禁用另一个名为period的输入元素,但它不起作用: <script type="text/javascript"> $(function(){ $("#custome

在输入框上使用jquery自动完成。这是工作100%,但认为造型需要一些工作

目前,jquery建议显示在其他输入元素的文本后面。如果单击选择框下方的jquery选项,则会触发选择框,而不是选择自动完成选项

如何将jquery自动完成配置为顶部?这是js问题还是css问题

我尝试使用以下代码禁用另一个名为period的输入元素,但它不起作用:

<script type="text/javascript">
      $(function(){
        $("#customer").autocomplete({
          minlength: 5,
          source: "get_customers",
           open: function(event, ui) { // disable other inputs
        $("input#period").attr("disabled", "disabled");
    },
      close: function(event, ui) { // re-enable other inputs
        $("input#period").removeAttr("disabled");
    },
          messages: {
          noResults: '',
          results: function() {}
      }


        });
      });
</script>

$(函数(){
$(“#客户”)。自动完成({
最小长度:5,
资料来源:“获取客户”,
打开:函数(事件、ui){//禁用其他输入
$(“输入周期”).attr(“禁用”、“禁用”);
},
关闭:函数(事件、ui){//重新启用其他输入
$(“输入周期”).removeAttr(“禁用”);
},
信息:{
结果:'',
结果:函数(){}
}
});
});

如果您有任何关于获取jquery列表“ontop”或禁用其他表单的建议,我们将不胜感激。

我看不到您的html标记,因此无法提供示例,但您需要使用css属性来解决此问题

您需要在包含所有建议的容器上使用它。您甚至可能需要在一些背景元素上设置它,但如果您尚未使用它,则不太可能

我通常将我的设置为999,如下所示:

z-index: 999;
只是为了确保它保持在顶部。

试试看

.ui-autocomplete{
   z-index:50;       //Where 50 is just an arbitrary number superior to your form's z-indexes
}
使用z索引属性

    .ui-autocomplete
{
       z-index:50;
}
使用appendTo:yourcainerdiv


我可以看一下现场链接吗?它可能是b z索引问题。。。在css中使用z索引
$("#TextBox").autocomplete({
                appendTo: '.ContainerDiv',
                source: function (request, response) {
                    $.ajax({
                        url: '@Url.Action("Action","Controller")',
                        type: "POST",
                        dataType: "json",
                        data: { Prefix: request.term },
                        success: function (data) {
                            response($.map(data, function (item) {
                                return { label: item.Name, value: item.Name };
                            }));

                        }
                    })
                }

            });