Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implemented removeTag method

  • Loading branch information...
commit 35cf3e2016e07a3c485c9d57d4886e7e41620482 1 parent ecec3c7
@nikku authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/jquery.tagit.js
View
16 lib/jquery.tagit.js
@@ -67,7 +67,6 @@
// Tag already added
if (selection.length) {
- self.trigger("tagit-tag-added");
return;
}
@@ -103,7 +102,20 @@
element.insertBefore($(".tagit-edit-handle", self));
}
- self.trigger("tagit-tag-added");
+ self.trigger("tagit-tag-added", [tag]);
+ },
+
+ removeTag: function(tag) {
+ var self = $(this);
+
+ var selection = self.find("input[type=hidden]").filter(function() {
+ return $(this).val() == tag;
+ });
+
+ if (selection.length) {
+ selection.parent().remove();
+ self.trigger("tagit-tag-removed", [tag]);
+ }
},
getTags: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.