Issue while loading taggit function after an ajax request #34

nandakumar444 opened this Issue Sep 23, 2011 · 2 comments


None yet

3 participants


I am using the plugin to load the tags to a text box. The tags will be retrieved from an Ajax request which will be called onload. The plugin will work properly if i attach the tagit function to the element before the ajax request. But if i try to set the available tags from the ajax request response there will be an error "$("#tag").tagit is not a function" .

the code is like this


function setTags()
$(":input").each(function(index) {
var elementId = '#'+(;
var tagAttribute = $(elementId).attr('tag');
if(typeof tagAttribute !== 'undefined' && tagAttribute !== false)
var data = {};
var url = absoluteurl+'/tags.php';
data['tg'] = tagAttribute;

        //response = ['PHP','MYSQL','JAVA','JAVASCRIPT'];
        setTagResponses(response, elementId);



function setTagResponses(tags, elementId)

if(tags.length > 0)
availableTags: tags


What if instead of passing the id for the element, you pass the element itself?

This looks pretty easy to debug if you set a break point inside setTagResponses and look at what you get with $(elementId) -- you might be passing in some value you didn't expect.


Closing this since it doesn't seem to be a bug with tag-it - LMK if it is or if you're still having trouble, thanks.

@aehlke aehlke closed this Nov 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment