Должно быть, мне что-то не хватает, но я не вижу его. Я использую tagsinput плагин Bootstrap, и я пытаюсь следовать некоторые из примеров здесь: 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
Я попытался удалить data-role="tagsinput"
, как предложено в this SO answer, но вход становится обычным текстовым полем, и исключение все еще происходит.
Что я делаю неправильно?
Вы пытались переупорядочить ваши теги скриптов, чтобы jQuery и Bootstrap приходили перед плагином tagin? – SimianAngel