jQUery自动完成不生成任何内容

时间:2015-10-14 00:31:33

标签: javascript jquery html autocomplete

我的自动填充不起作用,我只是构建一个简单的,无法使其工作,

<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta charset="utf-8"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="main.css" type="text/css">
    <script src="main.js"></script>
</head>
<body>
<div id="bigWrapper">

    <div id="content">
        <div id="formContainer" class="column">
            <form name="bankClearNr" method="GET">
                <label for="inputBox">Clearing</label>
                <input id="inputBox" type="text" name="inputBox" class="ui-front">
                <button class="right" type="button" id="confirmButton">&nbsp;Ok&nbsp;</button>
                <br><br>
                <label for="outputBox">BankID</label>
                <input type="text" id="outputBox" disabled>
            </form>
        </div>
    </div>

</div>
</body>
</html>

这是我使用的所有jQuery代码,这是html代码

{{1}}

1 个答案:

答案 0 :(得分:0)

您需要从class="ui-front"中删除input,它才有效 css似乎搞砸了,但我猜它错过了您的自定义main.css,即:

<input id="inputBox" type="text" name="inputBox">

----------

&#13;
&#13;
$(function() {
    var data = ["1200-1399", "1100-1199", "3400-3409", "5000-5999", "6000-6999", "7000-7120", "9050-9059", "9550"];
    $( "#inputBox" ).autocomplete({
        source: data
    });
});
&#13;
<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta charset="utf-8"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="main.css" type="text/css">
    <script src="main.js"></script>
</head>
<body>
<div id="bigWrapper">

    <div id="content">
        <div id="formContainer" class="column">
            <form name="bankClearNr" method="GET">
                <label for="inputBox">Clearing</label>
                <input id="inputBox" type="text" name="inputBox" class="ui-widget">
                <button class="right" type="button" id="confirmButton">&nbsp;Ok&nbsp;</button>
                <br><br>
                <label for="outputBox">BankID</label>
                <input type="text" id="outputBox" disabled>
            </form>
        </div>
    </div>

</div>
</body>
</html>
 
  
 
  
  
  
</body>
</html>
&#13;
&#13;
&#13;