views:

67

answers:

1

I'm using jQuery Tag Editor (http://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/) for a school project. Everything works perfect, but i'm not able to retrieve the array of tags that I added. This is my code:

$("#allTags").click(function () {

            var tags = $("#tagEditor").tagEditor().getTags();

            alert(tags);
        });

The array doesn't return anything.

This is the code from the jQuery Tag Editor:

(function ($) {
    $.fn.extend({
        tagEditor: function (options) {
            var defaults = {
                separator: ',',
                items: [],
                className: 'tagEditor',
                confirmRemoval: false,
                confirmRemovalText: 'Do you really want to remove the tag?',
                completeOnSeparator: false,
                completeOnBlur: false,
                initialParse: true
            }

            var options = $.extend(defaults, options);
            var listBase, textBase = this, hiddenText;
            var itemBase = [];

            this.getTags = function () {
                return itemBase.join(options.separator);
            };
...
A: 

If you still have problems with this then I would recommend that you get the latest version of the plugin (from the site you mentioned above). The getTags()-method was rewritten in the latest version and works much better now.

Karl-Johan Sjögren