我一定错过了一些简单的东西,但我看不到它。我正在使用 Bootstrap tagsinput 插件,我正在尝试遵循这里的一些示例:http: //bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
这是我的代码:
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap.tagsinput/0.4.2/bootstrap-tagsinput.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/bootstrap.tagsinput/0.4.2/bootstrap-tagsinput.min.js"></script>
</head>
<body>
<input id="cities" class="form-control" value="New York,London" data-role="tagsinput" type="text">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
$(function() {
$('#cities').tagsinput({
maxTags: 3
});
});
</script>
</body>
</html>
我收到以下 Javascript 错误:
tagsinput.html:15 Uncaught TypeError: $(...).tagsinput is not a function
我尝试按照此 SO 答案data-role="tagsinput"
中的建议删除,但输入变为常规文本框,异常仍然发生。
我究竟做错了什么?