samedi 2 juillet 2016

Uncaught TypeError: $(...).tokenfield is not a function


I'm new of jQuery and Bootstrap. everything was working perfectly until i decided to use the Bootstrap Tokenfield to add a search system based.

Bootstrap tokenfield

Now when i try to execute my ,jsp page i get: Uncaught TypeError: $(...).tokenfield is not a function

This is my .jsp page

JQuery import

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<link rel="stylesheet" href="/webjars/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="/webjars/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<title></title>

</head>

Component declaration

<input type="text" class="form-control" id="tokenfield" value="red,green,blue" />
$('#tokenfield').tokenfield({
  autocomplete: {
    source: ['red','blue','green','yellow','violet','brown','purple','black','white'],
    delay: 100
  },
  showAutocompleteOnFocus: true
})

Where am I doing worng? I'm forgetting to bring something?


Aucun commentaire:

Enregistrer un commentaire