开发者

jQuery tags or badges documentation

I'm trying to use the jQuery tags input开发者_开发问答 plugin, but there is not much documentation. I need to define event handlers for when a tag is added or removed. I guess I could make an object watch on the output string to determine this, but that is quite awkward.


Looking into the source code for the tags input plugin, there currently seems to be support for callbacks for addTag() and removeTag().

there appears to be 3 callback handlers you can register when you create the tag list. They are:

  1. onAddTag
  2. onRemoveTag
  3. onChange

when you create your tag list, try setting functions to these on the options object you pass it:

$(selector).tagsInput({
   onAddTag: function(value){
   // Do Stuff
   },
   onRemoveTag: function(value){
   // Do Stuff
   },
   onChange: function(tagList, value){
   // Do Stuff
   }
});

Note: I haven't tested this, but the source code indicates this should work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜