Tagit don't work if there is "a" tag inside li #102

Open
jcubic opened this Issue Sep 14, 2012 · 0 comments

Projects

None yet

1 participant

@jcubic
jcubic commented Sep 14, 2012

If child of the li is not simple text but node like link, it should add that link.

in order to fix this I need to use code like this

           var tag_list = $('.tags ul');
            var tags = tag_list.find('li').detach();
            var finish = false;
            tag_list = tag_list.tagit({
                allowSpaces: true,
                triggerKeys: ['enter', 'comma', 'tab'],
                onTagClicked: $.noop,
                onTagAdded: function(event, tag) {
                    if (finish) {
                        console.log(tag);
                    }
                },
                onTagRemoved: function(event, tag) {
                    console.log(tag);
                }
            });
            tags.each(function() {
                var a = $(this).find('a');
                tag_list.tagit("createTag", a.text()).
                    tagit('widget').find('.tagit-label:last')
                    .attr('href', a.attr('href'));
            });
            finish = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment