我无法理解我在这里做错了什么。我直接从以下代码库中复制了代码:https://codepen.io/jcarlos17/pen/xqYzzX,在此代码处工作正常。我正在导入JQuery,并且日志中没有错误。输入文本栏显示出来,我可以键入它,当我按回车键时,该文本将变成标签,但根本无法自动完成。
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>blah</title>
<!-- Compiled and minified CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/animate.css') }}">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/style.css') }}">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script>
</head>
<body>
<!-- Navigation Bar --
<ul>
<li><a class="active" href="index.html">Home</a></li>
<li><a href="#login">Login</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
------->
<!-- Page introduction box -->
<div class="chips-autocomplete"></div>
</body>
<script>
$(document).ready(function(){
$('.chips-autocomplete').material_chip({
secondaryPlaceholder: 'Ingrese síntomas',
placeholder: '+Síntoma',
autocompleteData: {
'DEBILIDAD': null,
'DIARREA': null,
'ABDOMEN AGUDO': null,
}
});
});
</script>
</html>
我要疯了。
答案 0 :(得分:0)
您加载了错误的脚本版本, 代替https://cdnjs.cloudflare.com/ajax/libs/materialize/ 0.97.8 /js/materialize.min.js
尝试加载:https://cdnjs.cloudflare.com/ajax/libs/materialize/ 0.98.0 /js/materialize.min.js
(更改以粗体显示)