You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
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();
});
function setTags()
{
$(":input").each(function(index) {
var elementId = '#'+(this.id);
var tagAttribute = $(elementId).attr('tag');
if(typeof tagAttribute !== 'undefined' && tagAttribute !== false)
{
var data = {};
var url = absoluteurl+'/tags.php';
data['tg'] = tagAttribute;
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.
Hi,
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();
});
function setTags()
{
$(":input").each(function(index) {
var elementId = '#'+(this.id);
var tagAttribute = $(elementId).attr('tag');
if(typeof tagAttribute !== 'undefined' && tagAttribute !== false)
{
var data = {};
var url = absoluteurl+'/tags.php';
data['tg'] = tagAttribute;
}
function setTagResponses(tags, elementId)
{
if(tags.length > 0)
{
$(elementId).tagit({
availableTags: tags
});
}
}
The text was updated successfully, but these errors were encountered: