jQuery Tag-It - using a value and label object list

前端 未结 7 1854
感动是毒
感动是毒 2021-02-02 16:58

Just tried the excellent Tag-It! plug-in for jquery (http://aehlke.github.com/tag-it/), but I can\'t get it to work how I would like.

I have an object list like this:

相关标签:
7条回答
  • 2021-02-02 17:38

    Inside the tag-it.js file where he commented with //Autocomplete, add an event option focus like I did below. This should fix it.

     // Autocomplete.
            if (this.options.availableTags || this.options.tagSource || this.options.autocomplete.source) {
                var autocompleteOptions = {
                    select: function(event, ui) {
                        that.createTag(ui.item.value);
                        // Preventing the tag input to be updated with the chosen value.
                        return false;
                    },
                    focus: function(event, ui) {
                        event.preventDefault();
                        that.tagInput.val(ui.item.label);
                    }
    
                };
    
    0 讨论(0)
提交回复
热议问题