From 70c60067e84dbba216cba89706e96bdd76e8aa7f Mon Sep 17 00:00:00 2001 From: lubber-de Date: Wed, 12 Dec 2018 00:23:43 +0100 Subject: [PATCH] fix(dropdown): Make #287 also work for div-dropdowns and prevent console error --- src/definitions/modules/dropdown.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index e6ba83c47e..bbbe682c0c 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -745,7 +745,11 @@ $.fn.dropdown = function(parameters) { if(settings.filterRemoteData) { module.filterItems(searchTerm); } - $.each($input.val(),function(index,value){ + var preSelected = $input.val(); + if(!Array.isArray(preSelected)) { + preSelected = preSelected!=="" ? preSelected.split(",") : []; + } + $.each(preSelected,function(index,value){ $item.filter('[data-value="'+value+'"]') .addClass(className.filtered) ;