Tagit自动完成功能不起作用

时间:2018-08-21 14:23:40

标签: jquery jquery-ui jquery-ui-autocomplete tag-it

基本上,我正在尝试将 tag it autocomplete 一起使用。

问题是我遇到了错误:

 jquery-ui.min.js:23 Uncaught TypeError: Cannot read property 'length' of undefined
         at b.(anonymous function).(anonymous function)._trigger (https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js:23:302)
         at b.(anonymous function).(anonymous function).search (https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js:241:194)
         at jquery-ui.min.js:236

HTML:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css">
    <link href="css/jquery.tagit.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div>
        <input name="tags" id="tagsInput">
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" crossorigin="anonymous"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/tag-it.js" type="text/javascript" charset="utf-8"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-debug.js" crossorigin="anonymous"></script>
</body>

JAVASCRIPT

$(document).ready(function () {     
    var availableTags = ["javascript","c#","bootstrap"];                    
    $('#tagsInput').tagit({
        availableTags: availableTags
    });
});

标记它已在本地加载,它是here中标记它的最新版本。

0 个答案:

没有答案