Sancho
Sancho

Reputation: 1390

jquery Tag-It doesn't autocomplete

I want to put a tag system. I choose http://aehlke.github.io/tag-it/.

I have the code:

 var availableTags = [
   {
        value: 1, label: 'tag1'
    },
    {
        value: 2, label: 'tag2'
    },
    {
        value: 3, label: 'tag3'
    }];

$(document).ready(function() {
    var version = $.ui ? $.ui.version || "pre 1.6" : 'jQuery-UI not detected';
    alert(version);
    $("#myTags").tagit({
        tagSource: availableTags,
        autocomplete: {
           delay: 0,
           minLength: 2,
           source : availableTags
        }
    });
});

In jsfiddle it work (http://jsfiddle.net/jg9qw/) but in my website it doesn't. The version var is set with "1.8.12".

I have no error in my website console log.

I can put/delete tag but the autocomplete doesn't work.

Css (from header)

<link href="/css/jquery.fancybox.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/css/jquery.tagit.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/css/tagit.ui-zendesk.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/css/jquery-ui.css" rel="stylesheet" type="text/css" media="all" />

Js (from header)

<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="/js/tag-it.js"></script>

Upvotes: 0

Views: 824

Answers (1)

FloriOn
FloriOn

Reputation: 287

This is not much information you gave, but one thing I can think of with this much information is that probably the order of the scripts are reverse. If you could show us a code from your website's header it would help in solving your problem. (just the scripts you links)

Yes, probably that's the case. Check their website for the correct order: https://github.com/aehlke/tag-it/blob/master/README.markdown

And I don't think that everything is necessary. And in your jquery ui make sure that the followings are contained: Core, Widget, Position, and Autocomplete

Try it with just the full jquery ui (just link the original one so you don't have to download) and the tag-it, nothing else. In case it doesn't work that way than something else is the source of the problem.

Upvotes: 1

Related Questions