自动填充功能对我来说不起作用

时间:2017-08-10 13:39:16

标签: javascript jquery jquery-ui autocomplete

我想使用新的表单自动填充功能,我尝试了但是没有下拉列表打开并建议搜索的单词。 class =" autocomplete"应该添加jquery $(input.autocomplete).....我的jquery代码是....

<script type="text/javascript">
  function bigger(){
        document.getElementById("approvals-data-box").style.width="95%";
        document.getElementById("actual-data").style.display="block";
  }

</script>

对于自动完成搜索,我使用了cdn脚本:     

如果它适用于其他人,那么请告诉我如何让它适合我。 如果有人有任何自动填充的链接,请分享我。

1 个答案:

答案 0 :(得分:0)

您的代码中存在一些问题。因为您必须知道物化的自动完成工具与输入字段一起使用。 因此,您必须为text-type-input中div之一的input-field元素之一提供一个类

$("#productName").autocomplete({
  data: {
    "Google": 'http://placehold.it/250x250',
    "G1": 'http://placehold.it/250x250',
    "G2": 'http://placehold.it/250x250',
    "Go3": 'http://placehold.it/250x250',
    "G4": 'http://placehold.it/250x250'
  };

我猜,代码看起来应该像 -

$('input.autocomplete').autocomplete({
  data: {
    "Google": 'http://placehold.it/250x250',
    "G1": 'http://placehold.it/250x250',
    "G2": 'http://placehold.it/250x250',
    "Go3": 'http://placehold.it/250x250',
    "G4": 'http://placehold.it/250x250'
  }
});

上面的代码定义了input元素的类autocomplete。 猜猜这有帮助。