Skip to content

Commit

Permalink
Merge pull request #155 from roooodcastro/fix-118
Browse files Browse the repository at this point in the history
Fixed value duplication bug (#118) for multiple mode
  • Loading branch information
sergiodlopes authored Feb 12, 2021
2 parents 9290979 + 5a399e4 commit a84adef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jquery.flexdatalist.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,12 @@ jQuery.fn.flexdatalist = function (_option, _value) {
*/
push: function (val, index) {
var current = _this.fvalue.get();
val = _this.fvalue.toObj(val);
current.push(val);
val = _this.fvalue.toStr(current);
_this.value = val;
if (!current.includes(val)) {
val = _this.fvalue.toObj(val);
current.push(val);
val = _this.fvalue.toStr(current);
_this.value = val;
}
},
/**
* Toggle value.
Expand Down

0 comments on commit a84adef

Please sign in to comment.