diff --git a/select2.js b/select2.js index ec8af72c..11e30516 100644 --- a/select2.js +++ b/select2.js @@ -2988,12 +2988,6 @@ the specific language governing permissions and limitations under the Apache Lic return; } - while((index = indexOf(this.id(data), val)) >= 0) { - val.splice(index, 1); - this.setVal(val); - if (this.select) this.postprocessResults(); - } - var evt = $.Event("select2-removing"); evt.val = this.id(data); evt.choice = data; @@ -3003,6 +2997,12 @@ the specific language governing permissions and limitations under the Apache Lic return; } + while((index = indexOf(this.id(data), val)) >= 0) { + val.splice(index, 1); + this.setVal(val); + if (this.select) this.postprocessResults(); + } + selected.remove(); this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });