响应大约有500条记录,自动完成后看起来很丑。如果建议超过10条,则是否有任何更改使列表看起来像组合框,而不是很长的列表?

谢谢

<html>
<head>
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function()
        {
            $('#textbox_postcode').autocomplete(
            {
                source: 'search-db.php',
                minLength: 3
            });
        });
    </script>
</head>

<body>
    <input type="text" id="textbox_postcode" value="" />
</body>
</html>

最佳答案

将以下内容添加到您的.css文件。

.ui-autocomplete {
max-height: 100px !important;
overflow-y: scroll;
}


max-height可以是任何您想要的。

10-05 20:36
查看更多