Skip to content

Commit 2fa5ac5

Browse files
committed
Fix: do not add item if empty
1 parent 956ce96 commit 2fa5ac5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/selectize.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ $.extend(Selectize.prototype, {
822822
/**
823823
* Resets the selected items to the given value.
824824
*
825-
* @param {mixed} value
825+
* @param {Array<String|Number>} value
826826
*/
827827
setValue: function(value, silent) {
828828
var events = silent ? [] : ['change'];
@@ -1602,6 +1602,8 @@ $.extend(Selectize.prototype, {
16021602
var i, active, value_next, wasFull;
16031603
value = hash_key(value);
16041604

1605+
if (value === '') return;
1606+
16051607
if (self.items.indexOf(value) !== -1) {
16061608
if (inputMode === 'single') self.close();
16071609
return;

0 commit comments

Comments
 (0)