为什么我的jQuery自动完成功能在页面左上方显示结果

时间:2019-05-28 09:37:42

标签: jquery jquery-ui-autocomplete

我将以下代码从jQuery文档和其他Google热门文章中拼凑而成。当我在自动完成字词中输入字母时,它总是在屏幕的左上方显示其结果。我在做什么错了?

<head>
  <meta name="viewport" content="width=device-width" />
  <title>Complete</title>
  <link href="~/Scripts/jquery-ui-1.11.4.custom/jquery-ui.css" rel="stylesheet" />
  <script src="~/Scripts/jquery-3.3.1.js"></script>
  <script src="~/Scripts/jquery-ui-1.11.4.custom/jquery-ui.js"></script>
</head>
<body>
  <div id="autoResults" style="margin-top: 50px;">
    <label for="Engineer">Select an Engineer: </label>
    <input id="Engineer">
  </div>
  <script>
    $(function() {
      $("#Engineer").autocomplete({
        @ * source: "@Url.Action("
        AutoCompleteOrgList ", "
        ContractManagement ")" * @
        source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"],
        appendTo: "#autoResults",
        position: {
          my: "left top",
          at: "left bottom"
        }
      });
    });
  </script>
</body>

0 个答案:

没有答案