Skip to content
This repository was archived by the owner on Sep 10, 2023. It is now read-only.

Commit 19dd42b

Browse files
committed
destroy method
1 parent b4425ac commit 19dd42b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/jquery.tokeninput.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ var methods = {
168168
setOptions: function(options){
169169
$(this).data("settings", $.extend({}, $(this).data("settings"), options || {}));
170170
return this;
171+
},
172+
destroy: function () {
173+
if(this.data("tokenInputObject")){
174+
this.data("tokenInputObject").clear();
175+
var tmpInput = this;
176+
var closest = this.parent();
177+
closest.empty();
178+
tmpInput.show();
179+
closest.append(tmpInput);
180+
return tmpInput;
181+
}
171182
}
172183
};
173184

0 commit comments

Comments
 (0)