From f49a62665a781a5ac3b115e1adcc2c06e46d3d6d Mon Sep 17 00:00:00 2001 From: Dasc3er Date: Tue, 29 Sep 2020 09:17:17 +0200 Subject: [PATCH] Fix #891 --- assets/src/js/functions/select.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/assets/src/js/functions/select.js b/assets/src/js/functions/select.js index 8d0d0874d..fde237def 100755 --- a/assets/src/js/functions/select.js +++ b/assets/src/js/functions/select.js @@ -207,17 +207,12 @@ jQuery.fn.selectData = function () { let selectData = this.select2('data'); if (this.prop('multiple')) { - let results = []; - for (const option of selectData) { - results.push(option.element.dataset); - } - - return results; - } else if (selectData.length === 0) { - return undefined; - } else { - return selectData[0].element.dataset; + return selectData; + } else if (selectData.length !== 0 && selectData[0].id) { + return selectData[0]; } + + return undefined; }; /**