diff --git a/js/bootstrap-combobox.js b/js/bootstrap-combobox.js index af5dc0d..c094112 100755 --- a/js/bootstrap-combobox.js +++ b/js/bootstrap-combobox.js @@ -35,6 +35,7 @@ this.matcher = this.options.matcher || this.matcher; this.sorter = this.options.sorter || this.sorter; this.highlighter = this.options.highlighter || this.highlighter; + this.newOptionsAllowed = this.options.newOptionsAllowed; this.shown = false; this.selected = false; this.refresh(); @@ -389,11 +390,16 @@ var that = this; this.focused = false; var val = this.$element.val(); - if (!this.selected && val !== '' ) { - this.$element.val(''); - this.$source.val('').trigger('change'); - this.$target.val('').trigger('change'); + if (this.newOptionsAllowed) { + this.$target.val(val); + } else { + if (!this.selected && val !== '' ) { + this.$element.val(''); + this.$source.val('').trigger('change'); + this.$target.val('').trigger('change'); + } } + if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);} } @@ -431,6 +437,7 @@ bsVersion: '3' , menu: '
' , item: '