Twitter bootstrap 引导标记输入如何将函数绑定到事件itemAdded和itemRemoved?
网站上没有关于事件的文档,有什么想法吗?也许作者还没有时间记录它呢?:-)但是,引导标记触发两个重要事件:Twitter bootstrap 引导标记输入如何将函数绑定到事件itemAdded和itemRemoved?,twitter-bootstrap,twitter-bootstrap-3,bootstrap-tags-input,Twitter Bootstrap,Twitter Bootstrap 3,Bootstrap Tags Input,网站上没有关于事件的文档,有什么想法吗?也许作者还没有时间记录它呢?:-)但是,引导标记触发两个重要事件:itemsadded和itemsremoved 以下是一个您可以尝试的示例: 标记: 事件侦听器: $(“#标记”).on('itemsadded',函数(事件){ console.log('添加的项目:'+事件.item); }); $(“#标记”)。在('itemRemoved',函数(事件){ console.log('item removed:'+event.item); });
itemsadded
和itemsremoved
以下是一个您可以尝试的示例:
标记:
事件侦听器:
$(“#标记”).on('itemsadded',函数(事件){
console.log('添加的项目:'+事件.item);
});
$(“#标记”)。在('itemRemoved',函数(事件){
console.log('item removed:'+event.item);
});
这是你的问题。@unclesol,调查一下代码,它并没有那么复杂,我的答案本来就不应该在那里……对我有用:)太好了!。对任何感兴趣的人都适用,这一点现在已完全记录在案: