使用引导程序标记管理器删除标记时获取回调

Get the callback while removing tag using bootstrap tag manager

本文关键字:获取 回调 删除 管理器 引导程序      更新时间:2023-09-26

我尝试使用"fillInputOnTagRemove"获取回调,同时使用引导标记管理器删除标记。这是链接。但它不起作用,也尝试了使用点击绑定监听器。它也不起作用。我尝试了以下方式

$(".tm-input").tagsManager({
  maxTags: 5,
  fillInputOnTagRemove: function() {
  //some content goes here
  return true;
 }
});

$(".tm-tag-remove").bind("click",function(){
 console.log("Removed tag");
});

删除标签时执行某些操作的最佳方式是什么?请分享你的想法。

谢谢-

试试这个:

$('.tm-input').on('tm:spliced tm:popped', function () {
    console.log(arguments);
});

您可以在tagsManager src 中找到其他支持的事件

jsfiddlehttp://jsfiddle.net/37okL66t/

如果您使用的是最新的3.0.1版本,在旧版本中,事件名称不同(tm:afterPoptm:afterSplice),则该功能有效。查看版本的源代码将非常有用