diff --git a/main/webapp/modules/core/scripts/util/custom-suggest.js b/main/webapp/modules/core/scripts/util/custom-suggest.js index 314333211..8b013bdd0 100644 --- a/main/webapp/modules/core/scripts/util/custom-suggest.js +++ b/main/webapp/modules/core/scripts/util/custom-suggest.js @@ -1,4 +1,17 @@ (function() { + /* + * Make suggest widgets clean up when removed. + */ + var oldInit = $.suggest.suggest.prototype._init; + $.suggest.suggest.prototype._init = function() { + oldInit.call(this); + + var self = this; + this.input.bind("remove", function() { + self._destroy(); + }); + }; + /* * Property suggest */