开发者

jQuery tag editor function

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().get开发者_StackOverflow中文版Tags();    
    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);
            };
...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜